-
Notifications
You must be signed in to change notification settings - Fork 0
/
query.htm
300 lines (300 loc) · 21 KB
/
query.htm
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE html>
<html>
<head>
<link href='common/css/evacation.css' rel="stylesheet" type='text/css'>
<title></title>
</head>
<body>
<div id='container' style='width:90%'>
<div id='content'>
<div id='wrapper' style='width:100%'>
<div id='main'>
<table>
<tr>
<td>
Use these queries to create new ones.<br>
Also use the <a href="DBScripts/evacation%20tables.jpg" target="_blank">tables description</a> and the <a href="DBScripts/evacation%20views.jpg" target="_blank">views description</a>.
<table>
<tr>
<td>
<br>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Add a new leave type</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> add a new leave type (other leave)<br>
<b>Comment:</b> the leave type name must not be longer than 30 characters.<br>
<br>
<b>INSERT INTO</b> tblLeaveType<br>
<b>VALUES</b> ('New Leave Name',1,1,0,0.5,0,0,0,1)<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Add a new bank holiday</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> insert an entry in the database.<br>
<b>Comment:</b> need to do that for each date but several INSERT INTO are allowed in the same query<br>
<br>
<b>INSERT INTO</b> tblPublicHoliday<br>
<b>VALUES</b> ('2012-10-08','Name of the bank holiday')<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page0"></a><div class='th'>Query: Delete a specific entry</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Delete good Friday in 2006 and 2007<br>
<br>
<b>DELETE FROM</b> tblPublicHoliday<br>
<b>WHERE</b> datDate=<i>'2006-04-14'</i><br>
<b>OR</b> datDate= <i>'2007-04-06'</i><br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Update basic entitlement</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Update to 23 the basic entitlement received by all employees each year<br>
<br>
<b>UPDATE</b> tblLeaveType<br>
<b>SET</b> dblEntitlement = 23<br>
<b>WHERE</b> <i>'Annual Leave'</i>=strLeaveTypeName<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Delete the content of a table</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b>Delete all entries of the WDS copy table<br>
<br>
<b>DELETE FROM</b> dbo.WorkerPrivate<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: List administrators</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Display evacation administrators<br>
<br>
<b>SELECT</b> wp.LastNm,wp.FirstNm, wp.WWID<br>
<b>FROM</b> dbo.qryWorkerPrivateAll wp , dbo.tblUser u<br>
<b>WHERE</b> wp.WWID = u.strWWID<br>
<b>AND</b> blnIsAdmin = 1<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: List tracked people</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Display people tracked in evacation<br>
<br>
<b>SELECT</b> wp.LastNm,wp.FirstNm, wp.WWID<br>
<b>FROM</b> dbo.qryWorkerPrivateAll wp , dbo.tblUser u<br>
<b>WHERE</b> wp.WWID = u.strWWID<br>
<b>AND</b> blnIsEELeaveTracked = 1<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Display a table</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Display all registered users, tracked or not<br>
<br>
<b>SELECT</b> *<br>
<b>FROM</b> tblUser<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Describe a table</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Describe the WDS copy table<br>
<br>
<b>SELECT</b> *<br>
<b>FROM</b> information_schema.columns<br>
<b>WHERE</b> table_name = '<i>WorkerPrivate</i>'<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Modify a table</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Add end of contract date the 28th August 2006<br>
<br>
<b>UPDATE</b> WorkerPrivate<br>
<b>SET</b> EndDt = '<i>20060828</i>'<br>
<b>WHERE</b> WWID='<i>10714570</i>'<br>
<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Add a field in a table</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Add the field to store the end of contract date in the table tblUser.<br>
<b>Comment:</b> If a view or a table is modified, all depending views will have to be re-create. Please also modify the file <i>createobject.sql</i>, it will be needed if the database is reloaded<br>
<br>
<b>ALTER TABLE</b> tblUser<br>
<b>ADD</b> endDate datetime<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Query: Display everybody</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> Disable all users except administrators. Usefull if making critical updates.<br>
<b>Comment:</b> The problem is to re-enable after, put this value to 1 will enable people which were not enabled before.<br>
<br>
<b>UPDATE</b> tblUser<br>
<b>SET</b> blnIsEELeaveTracked = 0<br></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<a name="Home Page"></a><div class='th'>Update procedure/view</div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><b>Description:</b> To update a procedure or a view, the administrator must delete it and re-create. The 2 SQL statements can be put in the same query.<br>
<b>Comment:</b> If a view or a table is modified, all depending views will have to be re-create. Don't forget to update <i>createobject.sql</i> as it is needed to recreate the database.<br>
<br>
<b>DROP PROCEDURE</b> dbo.pr_evc_elp_data_for_employee<br>
<br>
<b>CREATE PROCEDURE</b> dbo.pr_evc_elp_data_for_employee(@vWWID AS CHAR(8))<br>
<b>AS<br>
SET NOCOUNT ON<br>
SELECT</b> datActivated, dblInitialDaysBanked, dblTargetDays,lngID<br>
<b>FROM</b> dbo.tblELPInstance<br>
<b>WHERE</b> strEEWWID = @vWWID<br>
<b>RETURN</b><br></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>