SQL Query 1) Using CASE Statement : - To Check the Particular column ISNULL CASE WHEN ISNULL ([Col_Name], ' ') = ' ' THEN 'Others' ELSE [Col_Name] END AS [Col_Name] 2) Convert Data format into VARCHAR and save 10/18/2012 this Format and also check if Date Column is Empty or not. CONVERT (VARCHAR,[Col_CreatedDt], 101) AS CreatedDt , CASE WHEN ISNULL ([Col_ModifiedDt], ' ') = ' ' THEN ' not available' ELSE CONVERT (VARCHAR, [ Col_ModifiedDt], 101) END AS ModifiedDt 3) Casting and Check Date Difference CAST (Col_Name or ParameterName AS VARCHAR) DATEDIFF(HOUR,Col_Date, GETDATE())<=24 4) Create two table and set Primary key and Foreign Key Create Table Exams ( exam_id int primary key, exam_name varchar(50), );
Comments
Post a Comment