Nov 12, 2001 #1 JONBOY74 Technical User Sep 11, 2001 36 US Hi all Can you use IF statements with select statements so that, a error messege appears in place of the selected data if that data doesn't exist. Any help or pointer please Jon
Hi all Can you use IF statements with select statements so that, a error messege appears in place of the selected data if that data doesn't exist. Any help or pointer please Jon
Nov 12, 2001 #2 RickCole Technical User May 9, 2001 349 GB Yes you can user IF statements i.e. If (select count(*) from call_type) = 0 print 'No records returned' else print 'There are records' Rick. Upvote 0 Downvote
Yes you can user IF statements i.e. If (select count(*) from call_type) = 0 print 'No records returned' else print 'There are records' Rick.
Nov 12, 2001 #3 grahamm Programmer Sep 7, 2001 36 FR If you're talking about T-SQL in a stored procedure thenyou can use the builtin @@rowcount variable: select ... from ... where if @@rowcount=0 begin print "No Records Matched" return end Upvote 0 Downvote
If you're talking about T-SQL in a stored procedure thenyou can use the builtin @@rowcount variable: select ... from ... where if @@rowcount=0 begin print "No Records Matched" return end