Tuesday, June 28, 2011

Difference b/w count(*) and count(columnname)

-- To know @ Just copy & paste

declare
@TBL table(EID int,Ename varchar(10))

insert into @TBL(EID,Ename)
values(1,'Amit'),(2,'Rakesh'),(3,null)

select * from @TBL

select COUNT(*) from @TBL

select COUNT(Ename) from @TBL -- Note :: null values will not be considered.

No comments:

Post a Comment