Click to See Complete Forum and Search --> : Update ISNULL


rpcarnell
04-15-2007, 07:43 AM
I have this line for my .NET page:

string strCmd = "UPDATE pictures SET name = @name, width= @width, height = @height, description = @description WHERE (ids = @ids)";

The thing is that sometimes I want width or height, or maybe both to be null. But when I enter null values, the database turns them into zeros.

Is there an SQL way of fixing this? How do I use IsNULL in this context?

_________________________________________________________________
http://www.carbotek.org

mattyblah
04-15-2007, 08:23 PM
have you tried setting them to null in the code, something like:


string strCmd = "UPDATE pictures SET name = @name, width= null, height = null, description = @description WHERE (ids = @ids)";

Also, make sure in your table definition that the columns are nullable.