Date Functions Create a Stored Procedure CREATE …
[Pages:1]Data Types
Exact Numerics
bit
decimal
tinyint
money
smallint
bit
int
numeric
bigint
int
Approximate Numerics
float
real
Date and Time
smalldatetime
timestamp
datetime
Strings
char
text
varchar
Unicode Strings
nchav
ntext
nvarchar
Binary Strings
binary
image
varbinary
Miscellaneous
cursor
table
sql_variant
xml
Type Conversion
CAST (expression AS datatype) CONVERT (datatype, expression)
Ranking Functions
RANK DENSE_RANK
NTILE ROW_NUMBER
Grouping (Aggregate) Functions
AVG
MAX
BINARY_CHECKSUM MIN
CHECKSUM
SUM
CHECKSUM_AVG STDEV
COUNT
STDEVP
COUNT_BIG
VAR
GROUPING
VARP
Table Functions
ALTER CREATE
DROP TRUNCATE
Date Functions
DATEADD (datepart, number, date) DATEDIFF (datepart, start, end) DATENAME (datepart, date) DATEPART (datepart, date) DAY (date) GETDATE () GETUTCDATE () MONTH (date) YEAR (date)
Dateparts
Year Quarter Month Day of Year Day Week Hour Minute Second Millisecond
yy, yyyy qq, q mm, m dy, y dd, d wk, ww hh mi, n ss, s ms
Mathematical Functions
ABS ACOS ASIN ATAN ATN2 CEILING COS COT DEGREES EXP FLOOR LOG
LOG10 PI POWER RADIANS RAND ROUND SIGN SIN SQUARE SQRT TAN
String Functions
ASCII CHAR CHARINDEX DIFFERENCE LEFT LEN LOWER LTRIM NCHAR PATINDEX REPLACE QUOTENAME
REPLICATE REVERSE RIGHT RTRIM SOUNDEX SPACE STR STUFF SUBSTRING UNICODE UPPER
Create a Stored Procedure
CREATE PROCEDURE name @variable AS datatype = value
AS -- Comments SELECT * FROM table
GO
Create a Trigger
CREATE TRIGGER name ON
table FOR
DELETE, INSERT, UPDATE AS
-- Comments SELECT * FROM table GO
Create a View
CREATE VIEW name AS
-- Comments SELECT * FROM table GO
Create an Index
CREATE UNIQUE INDEX name ON
table (columns)
Create a Function
CREATE FUNCTION name (@variable datatype(length))
RETURNS datatype(length)
AS BEGIN
DECLARE @return datatype(length) SELECT @return = CASE @variable
WHEN 'a' THEN 'return a' WHEN 'b' THEN 'return b' ELSE 'return c' RETURN @return END
Available free from
................
................
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 download
- oracle to bigquer y sql translat ion reference
- date functions create a stored procedure create
- transact sql reference
- programming with transact sql visual objects
- copyright © tutorialspoint
- to char function with dates
- t sql data types
- introduction claros data management hach
- sql server according to bob two guys who work on sql
- purpose of chapter is to show how welcome ict seneca