티스토리 뷰

🌈 MsSql

@@ROWCOUNT

James Wetzel 2022. 7. 11. 13:52
728x90
반응형

 

최근 실행된 문의 영향을 받은 행 수를 반환합니다. 행 수가 20억 개보다 많을 경우 ROWCOUNT_BIG을 사용하세요.

USE AdventureWorks2012;  
GO

UPDATE HumanResources.Employee   
SET JobTitle = N'Executive'  
WHERE NationalIDNumber = 123456789  

IF @@ROWCOUNT = 0  
	PRINT 'Warning: No rows were updated';  
GO

 

728x90
반응형