Show Menu

SQL Server Cheat Sheet by DaveChild

A cheat sheet for Microsoft SQL Server.

SQL Server Data Types

Exact Numerics
bitdecimal
tinyintmoney
smallintnumeric
bigint
Appr­oximate Numerics
floatreal
Date and Time
smalld­atetimetimestamp
datetime
Stri­ngs
chartext
varchar
Unicode Strings
ncharntext
nvarchar
Binary Strings
binaryimage
varbinary
Misc­ell­ane­ous
cursortable
sql_va­riantxml

SQL Server Type Conversion

CAST (expre­ssion AS datatype)
CONVERT (datatype, expres­sion)

SQL Server Table Functions

ALTERDROP
CREATETRUNCATE
 

SQL Server Grouping (Aggregate) Functions

AVGMAX
BINARY­_CH­ECKSUMMIN
CHECKSUMSUM
CHECKS­UM_AVGSTDEV
COUNTSTDEVP
COUNT_BIGVAR
GROUPINGVARP

SQL Server Ranking Functions

RANKNTILE
DENSE_RANKROW_NUMBER

SQL Server String Functions

ASCIIREPLICATE
CHARREVERSE
CHARINDEXRIGHT
DIFFERENCERTRIM
LEFTSOUNDEX
LENSPACE
LOWERSTR
LTRIMSTUFF
NCHARSUBSTRING
PATINDEXUNICODE
REPLACEUPPER
QUOTENAME
 

SQL Server Date Functions

DATEADD (datepart, number, date)
DATEDIFF (datepart, start, end)
DATENAME (datepart, date)
DATEPART (datepart, date)
DAY (date)
GETDATE()
GETUTC­DATE()
MONTH (date)
YEAR (date)

SQL Server Dateparts

yy, yyyyYear
qq, qQuarter
mm, mMonth
dy, yDay of Year
dd, dDay
wk, wwWeek
hhHour
mi, nMinute
ss, sSecond
msMillis­econd

SQL Server Mathematical Functions

ABSLOG10
ACOSPI
ASINPOWER
ATANRADIANS
ATN2RAND
CEILINGROUND
COSSIGN
COTSIN
DEGREESSQUARE
EXPSQRT
FLOORTAN
LOG
 

Share This Cheat Sheet!

Favourited by 13 Members:

vbgenie ThibaultGomarin mrfatmen gmickd ciphan akipta sebbu Marty turborider cjvalotta SamCollett CyberTron catspaw82

Comments

mrfatmen mrfatmen, 17:51 17 Feb 14

Great cheatsheet, missing one thing. can you add the range for the numerics data types.
Theb it would be perfect.

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.