String Functions | Date Functions | Create a Stored Procedure | |
Exact Numerics | DATEADD (datepart, number, date) | CREATE PROCEDURE name | |
bit decimal | DATEDIFF (datepart, start, end) | @variable AS datatype = value | |
tinyint money | DATENAME (datepart, date) | AS | |
smallint numeric | DATEPART (datepart, date) | -- Comments | |
bigint | DAY (date) | SELECT * FROM table | |
Approximate Numerics | GETDATE() | GO | |
float real | GETUTCDATE() | ||
Date and Time | MONTH (date) | Create a Trigger | |
smalldatetime timestamp | YEAR (date) | CREATE TRIGGER name | |
datetime | Dateparts | ON | |
Strings | Year | yy, yyyy | table |
char text | Quarter | qq, q | FOR |
varchar | Month | mm, m | DELETE, INSERT, UPDATE |
Unicode Strings | Day of Year | dy, y | AS |
nchar ntext | Day | dd, d | -- Comments |
nvarchar | Week | wk, ww | SELECT * FROM table |
Binary Strings | Hour | hh | GO |
binary image | Minute | mi, n | |
varbinary | Second | ss, s | Create a View |
Miscellaneous | Millisecond | ms | CREATE VIEW name |
cursor table | AS | ||
sql_variant xml | SELECT * FROM table | ||
GO | |||
Type Conversion | Mathematical Functions | ||
CAST (expression AS datatype) | ABS | LOG10 | |
CONVERT (datatype, expression) | ACOS | PI | Create an Index |
ASIN | POWER | CREATE UNIQUE INDEX name | |
Ranking Functions | ATAN | RADIANS | ON |
RANK NTILE | ATN2 | RAND | table (columns) |
DENSE_RANK ROW_NUMBER | CEILING | ROUND | |
COS | SIGN | Create a Function | |
Grouping (Aggregate) Functions | COT | SIN | CREATE FUNCTION name |
AVG MAX | DEGREES | SQUARE | (@variable datatype(length)) |
BINARY_CHECKSUM MIN | EXP | SQRT | RETURNS |
CHECKSUM SUM | FLOOR | TAN | datatype(length) |
CHECKSUM_AVG STDEV | LOG | | AS |
COUNT STDEVP | BEGIN | ||
COUNT_BIG VAR | DECLARE @return datatype(length) | ||
GROUPING VARP | SELECT @return = CASE @variable | ||
WHEN 'a' THEN 'return a' | |||
Table Functions | String Functions | WHEN 'b' THEN 'return b' | |
ALTER DROP | ASCII | REPLICATE | ELSE 'return c' |
CREATE TRUNCATE | CHAR | REVERSE | RETURN @return |
CHARINDEX | RIGHT | END | |
DIFFERENCE | RTRIM | ||
LEFT | SOUNDEX | ||
LEN | SPACE | ||
LOWER | STR | ||
LTRIM | STUFF | ||
NCHAR | SUBSTRING | ||
PATINDEX | UNICODE | ||
REPLACE | UPPER | ||
QUOTENAME | |
SQL Reference Cheat Seat
- Posted by Prakash chheatry
- 2:13 AM
- 0 comments
- Labels: No labels
0 comments:
Post a Comment