开发者

sql server (updating)

if i update one record in table ...after updating how can i ensure that the tab开发者_如何学JAVAle has only one affected record. Im using sql server 2005


Use @@ROWCOUNT

USE AdventureWorks;
GO
UPDATE HumanResources.Employee 
SET Title = N'Executive'
WHERE NationalIDNumber = 123456789
IF @@ROWCOUNT = 0
PRINT 'Warning: No rows were updated';
GO
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜