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 string based on boolean

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-18 : 08:27:41
Clint writes "How do you make a SELECT statement that uses a boolean to select two different strings?

In Access it would be:
SELECT IIF(MyBoolean, MyTrueString, MyFalseString) FROM MyTable

But how do you do the equivalent in MSDE/SQL Server?

Thanks,
Clint"

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-05-18 : 08:31:17
SELECT
CASE
WHEN column1 = this THEN this
ELSE that
END
FROM Table


MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -