Code Snippet |
DECLARE @t table( id int identity(1,1), value varchar(50)) INSERT INTO @t values(NULL) INSERT INTO @t values(NULL) INSERT INTO @t values(NULL) INSERT INTO @t values('1') INSERT INTO @t values('2') INSERT INTO @t values('3') SELECT count(id), count(value) FROM @t |
with out executing the code, Can you tell me the output?
OOps, Its 6,3.... How? Its because, SQL Server will discard the null values and considered only the valid values for count function.
Happy Learning!!!
Regards,
Venkatesan Prabu .J
No comments:
Post a Comment