Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-01-19 : 08:38:18
|
| rob writes "In Transact SQL I want to allow for a row not found on a SELECT:e.g.SELECT *FROM NAMESWHERE SURNAME = 'ANCHOVY'IF NOT (@@ERROR = 0 OR @@ERROR = X) PRINT "UNEXPECTED ERROR"What is the X value?Also is there a better way of doing this?ThanksRob" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-19 : 08:55:43
|
| Did you execute that successfully?How about using this?If not exists(SELECT * FROM NAMES WHERE SURNAME = 'ANCHOVY')--Row not foundorSELECT * FROM NAMES WHERE SURNAME = 'ANCHOVY'if @@RowCount=0--Row not foundMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|