July 29, 2013 at 1:01 pm
In a result sql dataset if the value of a particular column is 0 i need to return Null, how do i approach write a query for that
Let's say i have 3 columns, Dept Name, Dept Division, Dept Count...Let say in my sql query if the Dept Count return 0 i should assign Null to it
July 29, 2013 at 1:16 pm
I would use a case statement to handle this.
July 29, 2013 at 1:16 pm
You could use NULLIF(DeptCount, 0)
EDIT: Add reference http://msdn.microsoft.com/en-us/library/ms177562%28v=sql.90%29.aspx
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply