[thelist] SQL Server & Stored Procedures

Anthony Baratta Anthony at Baratta.com
Mon Oct 29 23:50:33 CST 2001


At 09:20 PM 10/29/2001, you wrote:

>I would like to execute the UPDATE statement only if the DELETE command
>managed to delete something. So what's the best way to do this?

Straight from the SQL 7 on-line books:

UPDATE authors SET au_lname = 'Jones' WHERE au_id = '999-888-7777'
IF @@ROWCOUNT = 0
         print 'Warning: No rows were updated'

Hope that helps.
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."





More information about the thelist mailing list