Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test for UPDATE/INSERT success 1

Status
Not open for further replies.

mp89

Programmer
Sep 17, 2004
35
GB
Is it possible to test whether or not an UPDATE or INSERT actually updated/inserted a row in your stored procedure?


Cheers,

Mike
 
@@ERROR for success/failure status and @@ROWCOUNT to get number of row(s) affected... is that enough?
 
Thanks Vongrunt,

Excellent, just the type of test I was looking for :

--on insert

if @@rowcount = 0
--no rows were inserted


--on update

if @@rowcount = 0
--no rows were updated


Cheers,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top