correct,

you cannot put if..else within a query, but you can use CASE

eg

IF
BEGIN
     SELECT CASE WHEN X = Y THEN Y ELSE X END, OTHER_FIELDS FROM SOMEWHERE 
END
ELSE
BEGIN
     SELECT CASE WHEN X = X THEN Y ELSE X END, OTHER_FIELDS FROM SOMEWHERE 
END


>>> [EMAIL PROTECTED] 09/13/05 10:19 pm >>>
Hey guys

I am having to convert some large queries into stored proceedures but i
cant seem to work out how to do IF...ELSE inside the query in SQL.  Im
using MSSQL 2000

According to the docs you cant put the IF...ELSE inside the query, rather
the whole query goes inside the IF...ELSE conditions.

Is this right? or am i missing something

Steve

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED] 
To unsubscribe send a blank email to [EMAIL PROTECTED] 
Aussie Macromedia Developers: http://lists.daemon.com.au/


---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to