SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Bit data type
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Reji
Starting Member

India
2 Posts

Posted - 07/19/2010 :  10:30:47  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 07/19/2010 :  10:32:51  Show Profile  Reply with Quote
SELECT ISNULL(bitColumn,0)

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

Sachin.Nand
Flowing Fount of Yak Knowledge

2937 Posts

Posted - 07/19/2010 :  12:43:01  Show Profile  Reply with Quote
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 columname
ex
0 as 'bit'


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

Reji
Starting Member

India
2 Posts

Posted - 07/22/2010 :  00:42:19  Show Profile  Reply with Quote
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
Go to Top of Page

Sachin.Nand
Flowing Fount of Yak Knowledge

2937 Posts

Posted - 07/22/2010 :  02:01:44  Show Profile  Reply with Quote
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
Go to Top of Page

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 07/22/2010 :  14:48:06  Show Profile  Reply with Quote
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.

Edited by - Lamprey on 07/22/2010 14:48:23
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000