-
Notifications
You must be signed in to change notification settings - Fork 39
/
snippet-list.txt
113 lines (112 loc) · 3.92 KB
/
snippet-list.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
GitHub /sqlpromptsnippets File Index
File Description
------- -------------------------------------------------------------------------------
ac ALTER COLUMN
af ALTER FUNCTION
ap ALTER PROCEDURE
at ALTER TABLE
ata Add column
atac Modify column
atd Drop column
atdc Drop constraint
atdt Disable a trigger on table
atdta Disable all triggers on table
atet Enable a trigger on table
ateta Enable all triggers on table
be BEGIN...END
bt BEGIN TRANSACTION
ccc CREATE CELL CALCULATION fragment
cci Create non-unique clustered index
cdb CREATE DATABASE
cdbsnap Create a database snapshot
citf Create inline table-valued function
cj CROSS JOIN fragment
cl Create a new SQL Server login
clrp Create a CLR stored procedure
cni Create non-unique nonclustered index
cp Create a stored procedure
cseq Create a sequence (start, end, optional: cycle, cache)
csf Create scalar function
ct Create a table
cte Create a new common table expression
ctf Create table-valued function
ctr Commit transaction
ctt Create temp table (drops if exists)
cu Create a database user
cuci Create unique clustered index
cuni Create unique nonclustered index
curff Boilerplate code for fast-forward read-only cursor
cv Create a view
cw CASE WHEN
dd Drop a database
df DELETE FROM fragment
dfn Drop a function
di Drop an index
dl Drop a login
dp Drop a stored procedure
dseq Drop a sequence
dt Drop a table
du Drop a user
dupk Check for duplicated values on a column
dv Drop a view
err Inserts @@ERROR function call
fj FULL JOIN fragment
foj FULL OUTER JOIN fragment
gb GROUP BY
gep Grant Execute on procedures
git Grant Insert on table
giust Grant Insert, Select, Update on table
gst Grant Select on table
gut Grant Update on table
header Template header for stored procedure
hhmm string to HH:mm format
ifs IF fragment
ii INSERT INTO fragment
ij INNER JOIN fragment
j JOIN fragment
inn IS NOT NULL fragment
is Shortcut for INFORMATION_SCHEMA
isc Column Information Grabber
isns Wraps the currently selected column (text) in an ISNULL Function, with a default empty string (this is an inline selected text function)
isnn Wraps the currently selected column (number) in an ISNULL Function, with a default to zero (this is an inline selected text function)
lin Line
linn Double line with space for text comment
lj LEFT JOIN
lk LIKE '% %' fragment
loj LEFT OUTER JOIN fragment
mmddyyyy String to mmddyyyy format
mmddyyyyhhmm String to mmddyyyyhhmm format
mro Retrieves information about 20 most recently created objects from database
neo A word from one of our sponsors
num Format a big number into a readable format
numc Nicely formatted COUNT(*) as numRows
nvseq Next value for a sequence
ob ORDER BY
rj RIGHT JOIN fragment
rnum ROW_NUMBER() OVER () fragment
roj RIGHT OUTER JOIN fragment
rt Rollback transaction
san Change the current ANSI_NULLS setting
scf Count number of records returned by query, formatted nicely
sd SELECT DISTINCT
setvar SQL CMD setvar fragment
smf SELECT SUM() FROM
sph Execute sp_help
spt Execute sp_helptext
sqi Change the current QUOTED_IDENTIFIER setting
ss0 SELECT TOP 0 * FROM
ssf SELECT * FROM fragment
ssf2 SELECT * FROM fragment, formatted nicely with tabs and newline.
sst SELECT TOP 1000 * FROM
st100 SELECT top 100 rows
sxa Change the current XACT_ABORT setting
tc TRY ... CATCH fragment
today CAST(GETDATE() as date) fragment
trim Trim a string: LTRIM(RTRIM($CURSOR$))
trims Wrap selected text in LTRIM(RTRIM($SELECTEDTEXT$))
uci Unique Clustered Index
w2 Execute sp_who2
wdc WITH (DATA_COMPRESSION = PAGE) fragment
wt WITH (TABLOCK) fragment
xpfd Retrieve free space on all fixed drives
yell Vent your frustration