In a stored procedure, I'm storing the result of a select statement in @variable. Is there a way to capture a SQL Code 100, like Oracle's SQLERRM(100)/ORA-01403 if no records are returned? I'm currently setting @variable = '*' before the select and and IF @variable = '*' afterwards, but there must be a more elegant way - isn't there?
Software/Hardware used:
ASKED:
August 15, 2008 2:41 PM
UPDATED:
March 6, 2012 5:44 PM
Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.
if no records are there it will return one row and with null value.