Nov 12, 2001 #1 JONBOY74 Technical User Joined Sep 11, 2001 Messages 36 Location 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 Joined May 9, 2001 Messages 349 Location 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 Joined Sep 7, 2001 Messages 36 Location 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