SQL Server Cheat Sheet
SQL Server Cheat Sheet
Dateparts Year Quarter
Month Day of Year Day
Week Hour
yy, yyyy qq, q
mm, m dy, y dd, d
wk, ww hh
Minute Second
mi, n ss, s
Millisecond ms
Day Of Week dw Date Functions DATEADD (datepart, number, date) DATEDIFF (datepart, start, end) DATENAME (datepart, date)
DATEPART (datepart, date)
DAY (date) GETDATE ()
GETUTCDATE () MONTH (date) YEAR (date)
Convert Date Style Codes mon dd yyyy hh:miAM
100 (or PM) 101 mm\dd\yyyy 103 dd/mm/yy 120 yyyy-mm-dd hh:mi:ss
Convert(Datatype, Date, Style)
System Data Types
bigint
-2^63 to 2^63-1
binary
8 Bytes
bit char cursor
datetime decimal
January 1, 1753, through December 31, 9999 - 10^38 +1 through 10^38 - 1
2 4 byte integers
float image
int
money nchar ntext numeric nvarchar
real
smalldatetime smallint
smallmoney sql_variant table text timestamp
- 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308
-2^31 (-2,147,483,648) to 2^31-1
(2,147,483,647)
4 Bytes
-922,337,203,685,477.5808 to 922,337,203,685,477.5807 8 Bytes
Equiv. to decimal
- 3.40E + 38 to -1.18E - 38, 0
and 1.18E - 38 to 3.40E + 38
(Equiv. to Float(24)
4 Bytes
January 1, 1900, through June 2 2 byte
6, 2079
integers
-2^15 (-32,768) to 2^15-1 (32,767) 2 Bytes
- 214,748.3648 to 214,748.3647
4 Bytes
tinyint varbinary varchar uniqueidentifier xml Date Time
DateTime2 DateTimeOffset Geometry Geography HierarchyId
0 to 255
1 Byte
Accurate to 100 nanoseconds 1/1/1 to 12/31/9999
Mathematical Functions ABS ACOS
ASIN ATAN ATN2
CEILING COS
String Functions ASCII CHAR
CHARINDEX DIFFERENCE LEFT
Char. to find, String to search, [start])
LEN LOWER
Ranking Functions RANK DENSE_RANK
NTILE ROW_NUMBER
Aggregate Functions AVG
COT DEGREES
EXP
FLOOR LOG LOG10 PI POWER
LTRIM NCHAR
PATINDEX
REPLACE QUOTENAME REPLICATE REVERSE RIGHT
(Pattern, Expression)
(String, Substring, Replacement)
BINARY_CHECKSUM CHECKSUM
CHECKSUM_AVG
COUNT COUNT_BIG GROUPING MAX MIN
RADIANS
RAND ROUND
SIGN SIN SQUARE SQRT TAN
RTRIM
SOUNDEX SPACE
STR STUFF SUBSTRING UNICODE UPPER
(String, Start, Length)
SUM
STDEV STDDEVP
VAR VARP
Syntax row_number() over(order by [Column])
declare CursorName cursor local fast_forward for
{Select}
open CursorName fetch next from Diff_Cursor into @ColumnA, @ColumnB while @@FETCH_STATUS = 0 begin
{Work} fetch next from Diff_Cursor into @ColumnA, @ColumnB end close CursorName deallocate CursorName
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- sql server data classification
- sql server data classification tool
- sql server data types
- azure sql server hyperscale
- sql server 2016 string functions
- sql server connection strings
- sql server localhost connection string
- sample sql server connection string
- sql server trusted connection string
- sql server trusted connection true
- sql server connection string trusted connection
- connection string c sql server examples