Translate

> > Stored Procedure Check wheather a row is inserted or not

Stored Procedure Check wheather a row is inserted or not

Posted on Thursday, July 5, 2012 | No Comments

DECLARE @SQL nvarchar(2000)

SET @SQL = 'INSERT INTO ----------------------'

Exec sp_executesql @SQL

    IF @@ROWCOUNT = 1
    BEGIN
        SET @SQL = 'UPDATE [BuyCentral] SET [BalQty]=[BalQty]-' + @SQty + ' , [SQty]=[SQty]+'     +     @SQty + ' Where [ItemID]=' +@ItemID + ''

        Exec sp_executesql @SQL
    END




[Here @@ROWCOUNT a builtin variable which store if a insert or update or delete statement execute successfully]

Leave a Reply

Powered by Blogger.