DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   
Stats
Total Count : 4
Resources Publish New Article  
 
Difference between count(*) and count(column_name)
Ashok Nalam
We might assume that count(*) and count(column_name) will return same result count. But NO, in case of column holds any null values.

Count (*) – returns all values (including nulls and duplicates)
Count (Column_Name) – returns all Non-NULL values(including duplicates)

In the below script we will see how it works. So that it will be easy for us to understand.
create table #tempTable(Name char(1))
insert into #tempTable values("A")
insert into #tempTable values("B")
insert into #tempTable values(Null)
insert into #tempTable values("C")
insert into #tempTable values(Null)
insert into #tempTable values("C")
select COUNT(*) from #tempTable
select COUNT(Name) from #tempTable
drop table #tempTable
Output: 6 and 4
The table #temptable has total 6 rows. Count(*) returns all the rows including null/duplicates but where as count(name) returns only 4 rows which includes duplicates("C") but not null values.

If you want to remove the duplicates from count(Name) then use distinct keyword in it.
select COUNT(distinct Name) from #tempTable –-returns 3
By: Ashok Nalam | 28 Dec 2012 | SQL Server | Views: 5188 | Comments: 0 | Tags:difference  tsql 
What is managed and unmanaged code in .NET
Ashok Nalam
Manged Code - code which is executed under Common Language Runtime (CLR). Due to this, the code has  many benefits like memory management, support of version control, type safety and security. The code which targets CLR and written in .NET framework is a managed code. E.g: C#,VB.NET

Unmanaged code : code which is not executed under .NET runtime (CLR). CLR is does not have control over execution of code.memory management, security and type safety should be taken care by developer.  
E.g: VB6, C,C++. 

managed code typically compiled to Intermediate Language(IL) code where as unmanged code directly compiles to native code.
By: Ashok Nalam | 30 Dec 2012 | .NET Framework | Views: 6018 | Comments: 0 | Tags:.NET  difference 
VB.NET/C# program to convert Fahrenheit to Celsius and Celsius to Fahrenheit
Ashok Nalam
This program(VB.NET/C# versions) converts temperature from Fahrenheit to Celsius and Celsius to Fahrenheit.
By: Ashok Nalam | 28 Jun 2013 | VB.NET | Views: 24834 | Comments: 405 | Tags:.NET  C#  conversion  difference  number 
Difference between string.IsNullOrWhiteSpace and string.IsNullOrEmpty
Ashok Nalam
The snippet covers difference between string.IsNullOrWhiteSpace and string.IsNullOrEmpty using an example.
By: Ashok Nalam | 19 Nov 2013 | C# | Views: 5436 | Comments: 0 | Tags:.NET  difference  string