Avatar of poultarp
poultarp

asked on 

Using Select statement in IF statement

Hi

I want to use an IF statement to check if a SELECT statement returns values. If the SELECT returns values I want to do one thing, and if it does not return any values I want to do another thing.

Something like this:

IF (SELECT * FROM TEMP_TABLE) <> NULL
BEGIN
  Do Something
END
ELSE
BEGIN
  Do Something Else
END

My problem is that I can't get the IF statement right.

Can anyone help???

Thanks in advance!

Regards
Søren Augustesen
Microsoft SQL Server 2005SQL

Avatar of undefined
Last Comment
rachitkohli

8/22/2022 - Mon