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 2000 Forums
 Transact-SQL (2000)
 Select true/false does not work

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-09 : 08:11:00
Bernardo writes "In MySQL the statement
"Select 1>2;" returns False (and obviously True for true statements).
I need this to work in SQL, do you know how?
Regards
Bernardo Zamora"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-08-09 : 08:12:25
There is no True or False value in SQL Server, but you can do this:

SELECT CASE WHEN 1>2 THEN 'False' ELSE 'True' END

The CASE expression is explained in more detail in SQL Server Books Online, also read these articles:

http://www.sqlteam.com/SearchResults.asp?SearchTerms=case

Go to Top of Page
   

- Advertisement -