Show Menu

SQL Server Data Types

Exact Numerics
bit decimal
tinyint money
smallint numeric
bigint
Appr­oximate Numerics
float real
Date and Time
smalld­atetime timestamp
datetime
Stri­ngs
char text
varchar
Unicode Strings
nchar ntext
nvarchar
Binary Strings
binary image
varbinary
Misc­ell­ane­ous
cursor table
sql_va­riant xml

SQL Server Type Conversion

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

SQL Server Table Functions

ALTER DROP
CREATE TRUNCATE
 

SQL Server Grouping (Aggregate) Functions

AVG MAX
BINARY­_CH­ECKSUM MIN
CHECKSUM SUM
CHECKS­UM_AVG STDEV
COUNT STDEVP
COUNT_BIG VAR
GROUPING VARP

SQL Server Ranking Functions

RANK NTILE
DENSE_RANK ROW_NUMBER

SQL Server String Functions

ASCII REPLICATE
CHAR REVERSE
CHARINDEX RIGHT
DIFFERENCE RTRIM
LEFT SOUNDEX
LEN SPACE
LOWER STR
LTRIM STUFF
NCHAR SUBSTRING
PATINDEX UNICODE
REPLACE UPPER
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, yyyy Year
qq, q Quarter
mm, m Month
dy, y Day of Year
dd, d Day
wk, ww Week
hh Hour
mi, n Minute
ss, s Second
ms Millis­econd

SQL Server Mathematical Functions

ABS LOG10
ACOS PI
ASIN POWER
ATAN RADIANS
ATN2 RAND
CEILING ROUND
COS SIGN
COT SIN
DEGREES SQUARE
EXP SQRT
FLOOR TAN
LOG
 

Share This Cheat Sheet!

Favourited by 13 Members:

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

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.