Define MSSQL

SQL Data Types

SQL Commands

SQL Create Database

SQL Create Table

SQL Insert Into

SQL Select Query

SQL Orderby

SQL Update Command

Truncate Delete Drop

SQL Select Top

SQL Constraints

SQL Alias

SQL Joins

SQL Union, intersect

SQL Select Into

SQL Insert Into Select

SQL Indexes

SQL Alter Table

SQL AutoIncrement

SQL View

SQL Date Functions

SQL NULL Value

SQL Aggregate Functions

SQL Group By

SQL Scalar functions

Stored Procedure

MS-SQL Date Functions

CommandDescription
Getdate()Returns the current date and time
Datepart()Returns a single part of a date/time
Dateadd()Adds or subtracts a specified time interval from a date
Datediff()Returns the time between two dates

Select getdate()
Select datepart(d,getdate())
Select Dateadd(d,45,getdate())
Select * from Order where OrderDate = '2008-11-11'

Convert Functions
The Convert function is a general function that converts an expression of one data type to another.
Select Convert (Data_type(length), Expression, Style)
Select Convert (Varchar(10), Getdate(), 5)

ValueInput/Output
1 or 101mm/dd/yy
2 or 102yy.mm.dd
3 or 103dd/mm/yy
4 or 104dd.mm.yy
5 or 105dd-mm-yy
8 or 108hh:mm:ss
9 or 109mon dd yyyy hh:mi:ss:mmm AM (or PM)
10 or 110mm-dd-yy
11 or 111yy/mm/dd
13 or 113dd mon yyyy
14 or 114hh:mi:ss:mmm (24h)