Natloz, My query is contained within a variable and I am running it using a nested EXEC statement.
I tried using your suggestion already but got into difficulties with the syntax:
IF (EXEC('SELECT COUNT(*) FROM ('+@SQLTEXT+') A')=0)
gives
Error 156: Incorrect syntax near the keyword 'EXEC',
Line 81: Incorrect syntax near '='
Main Topics
Browse All Topics





by: natlozPosted on 2007-07-24 at 07:32:26ID: 19556455
Can you do:
If(select count(*) your QUERY = 0)
begin
second query
end
else
begin
first query
end