Collections:
What Is a Boolean Value in SQL Server
What Is a Boolean Value in SQL Server Transact-SQL?
✍: FYIcenter.com
A Boolean value indicates a condition in a state of TRUE or FALSE. In Transact-SQL language, there is not storage data type defined to store a Boolean value. So Boolean values can only exist temporarily as part of the execution of Transact-SQL expression or statement.
Boolean values are returned from comparison operations. The tutorial exercise below shows you some examples of how Boolean values are used:
-- Boolean values in a CASE expression
SELECT CASE WHEN 1>0 THEN
'True'
ELSE
'False'
END;
GO
True
-- Boolean values in an IF statement
IF 1>0
SELECT 'True';
ELSE
SELECT 'False';
GO
True
-- Stand alone Boolean value not allowed
SELECT 1>0;
GO
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '>'.
⇒ CASE - Conditional Expressions in SQL Server
⇐ Boolean Values and Logical Operations in SQL Server Transact-SQL
⇑ Boolean Values and Logical Operations in SQL Server Transact-SQL
2017-01-29, 3011🔥, 0💬
Popular Posts:
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...
How AdventureWorksLT tables are related in SQL Server? There are 12 user tables defined in Adventure...
What Are the Differences between BINARY and VARBINARY in MySQL? Both BINARY and VARBINARY are both b...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...
How to print value on console in SQL Server Transact-SQL? How to use the PRINT statements? In Transa...