Thursday, January 1, 2015

C# check any type null

You can use this to check null

 public static bool CheckNullOrEmpty<T>(T value)  
 {  
    if (typeof(T) == typeof(string))  
     return string.IsNullOrEmpty(value as string);  
    return value == null || value.Equals(default(T));  
 }  

SQL get all table column which is null in database

create table #SuspectColumns ( TABLE_SCHEMA sysname, TABLE_NAME sysname, COLUMN_NAME sysname ) declare csrColumns ...