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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Bit datatype issue

Author  Topic 

Catchitbaby
Starting Member

2 Posts

Posted - 2014-01-07 : 12:26:49
declare @aa bit
set @aa = 343
select @aa

output : 1

Why ?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-07 : 12:31:48
Because the data type is bit. Bit can have 3 values: 1, 0 or NULL.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-08 : 05:47:10
Anything except 0 and NULL it returns value as 1

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -