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
 General SQL Server Forums
 New to SQL Server Programming
 Regarding if and else

Author  Topic 

mailtosaja
Starting Member

28 Posts

Posted - 2008-10-22 : 12:05:04
Hi,
if @temp_function_level1 != @function_level1 and @temp_function_level2 != @function_level2 then
BEGIN
code...
END

it's not working .can any one tell what is the mistake....

Thanks & Regards,
S.WoodSon.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-10-22 : 12:19:57
take away 'then'.
also specify us 'it's not working' please.

Webfred

No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-10-22 : 12:32:44
THEN is a keyword for the CASE statement. Not the IF statement in TSQL.

Also != strictly speaking (even though it works fine) isn't standard syntax. You may want to use <> instead.

-------------
Charlie
Go to Top of Page
   

- Advertisement -