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)
 Resultset change

Author  Topic 

strikeuk
Starting Member

2 Posts

Posted - 2008-09-18 : 09:28:08
Hi, will it be possible for me to rename my resultset in sql base on a certain condition? For eg, i do a select statement on a price, if the result is zero then it should print out as FOC in a column. Is this possible? Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-26 : 04:07:04
Use CASE.

SELECT Col1, Col2, CASE WHEN Col3 = 0 THEN 'FOC' ELSE STR(Col3, 15, 4) END
FROM Table1



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -