Case 1: When used with select statement that does not return any rows
select 1 where 1=2      
select @@rowcount
select @@rowcount
Case 2: When used with SET options (setting nocount on/off, datefirst values, etc)
set nocount off      
select @@rowcount
select @@rowcount
Case 3: When used with USE satement which changes the current database name
use master      
select @@rowcount
  select @@rowcount
OUTPUT
 
No comments:
Post a Comment