Tuesday, March 27, 2012

Boolean expression in SQL

Hello,
In VB/VB.NET, I can use an expression as such to evaluate true/false:
Dim blnValue As Boolean = (SomeObject.Property = "Some value")
Can I do this in T-SQL?
declare @.var bit
set @.var = ?
Thanks.

T-SQL uses ANSI SQL CASE statement for Boolean expression, try the links below for more info. Hope this helps.
http://builder.com.com/5100-6388-5078041.html

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_5t9v.asp

|||

bmains wrote:

Hello,
In VB/VB.NET, I can use an expression as such to evaluate true/false:
Dim blnValue As Boolean = (SomeObject.Property = "Some value")
Can I do this in T-SQL?
declare @.var bit
set @.var = ?
Thanks.


Bit type data can hold either a 1 or 0. So you have to set it to either 1 or 0. You might use it like boolean. One bit value will occupy 1 bytes of space.
Hope this helps.sql

No comments:

Post a Comment