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.
| Author |
Topic |
|
neutcomp
Posting Yak Master
111 Posts |
Posted - 2002-11-25 : 10:05:00
|
| Hello,is there a way to use a if else construction in your sql code?I use SQL server enteprise edition.Something like:SELECT activeFROM tbl_personIF active = "yes" THEN SELECT name from tbl_personElseSELECT error_message from tbl_error_messagesThanxxBjornCyaBjorn |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-11-25 : 10:12:12
|
| declare @Active intselect @Active = active from tblPerson where id = @user_idif @Active = 1SELECT name from tbl_person elseSELECT error_message from tbl_error_messagesAlso look at the case statement.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|