Month: August 2012


  • CHARINDEX (Transact-SQL)

    Syntax: CHARINDEX ( expressionToFind ,expressionToSearch [ , start_location ] ) A. Returning the starting position of an expression The following…


  • Add new columns to existing table. Using by Alter Table.

    Add  new columns to existing table ALTER TABLE [YOURDATABASENAME].[dbo].[YOURTABLE] ADD NEWCol1 NVARCHAR(20); ALTER TABLE [YOURDATABASENAME].[dbo].[YOURTABLE] ADD NEWCol2 DATETIME; ALTER TABLE…


  • Insert into temp table with Union All in SQL

    If you are trying to insert all records from multiple tables to one temp table, the following codes may help.…


  • SQL Zero Date Time

    Someone may need to use Zero Date instead of null with datetime datatype SELECT CONVERT(DATETIME,’1900–01–01 00:00:00.000′) Return Result: 1900-01-01 00:00:00.000