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 2005 Forums
 Transact-SQL (2005)
 IF statement syntax in MS SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-03-07 : 08:38:38
Sandeep writes "hi,

I need the syntax for IF else statement in MSSQL. Can you send it to me as soon as possible.

Regards,
Sandeep"

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-07 : 09:19:21
why don't you look it up in the SQL Server Books OnLine


KH

Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-03-08 : 16:32:17
it's the same...
if condition
perform some ops here
else
perform some ops here

there's no then...be sure to enclose with a begin..end if more than 1 statement (same as any programming language)

or if it's inline, use CASE (same as C, for actual syntax, refer to BOL)

HTH

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -