Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Reji
Starting Member
2 Posts |
Posted - 2010-07-19 : 10:30:47
|
Hi,I have one bit data type column in SQL Server 2008, I want to retrieve that value always 0 even if it containing NULL. can any one know like setting that we can do in db. Thanks in Advance.Reji |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-07-19 : 10:32:51
|
SELECT ISNULL(bitColumn,0)JimEveryday I learn something that somebody else already knew |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-19 : 12:43:01
|
quote: Originally posted by Reji Hi,I have one bit data type column in SQL Server 2008, I want to retrieve that value always 0 even if it containing NULL. can any one know like setting that we can do in db. Thanks in Advance.Reji
0 as your columnameex0 as 'bit'Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
|
|
Reji
Starting Member
2 Posts |
Posted - 2010-07-22 : 00:42:19
|
Thanks. My requirement is something diferent. I will describe the scenario. Due to one middle driver issue, earlier version of the driver was retrieved 0 in bit column even if value is NULL. But now updated driver rturning NULL for NULL. I want to supress this behaviore(Because UI code already done with respect to this behaviore). In left outer join also I want 0 value for NULL. I am not ready to change the UI code or procedure. Thanks,PRR |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-22 : 02:01:44
|
But in your previous post you stated that you wanted to display always 0 no matter what the values is.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-07-22 : 14:48:06
|
quote: Originally posted by Reji Thanks. My requirement is something diferent. I will describe the scenario. Due to one middle driver issue, earlier version of the driver was retrieved 0 in bit column even if value is NULL. But now updated driver rturning NULL for NULL. I want to supress this behaviore(Because UI code already done with respect to this behaviore). In left outer join also I want 0 value for NULL. I am not ready to change the UI code or procedure. Thanks,PRR
See Jims post from 07/19/2010 : 10:32:51 and use the ISNULL function or, if you want to be ANSI/ISO compiant, use the COALESCE function. |
|
|
|
|
|
|
|