database.mssql 13.6 KB
Newer Older
Dries's avatar
   
Dries committed
1
2
3
4
---
--- Table definitions
---

Dries's avatar
 
Dries committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE TABLE [dbo].[access] (
  [aid] [smallint] NULL ,
  [mask] [varchar] (255) NOT NULL ,
  [type] [varchar] (255) NOT NULL ,
  [status] [smallint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[accesslog] (
  [nid] [numeric](11, 0) NULL ,
  [url] [varchar] (255) NULL ,
  [hostname] [varchar] (128) NULL ,
  [uid] [numeric](10, 0) NULL ,
  [timestamp] [numeric](11, 0) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[authmap] (
Dries's avatar
   
Dries committed
23
  [aid] [numeric](10, 0) IDENTITY NULL ,
Dries's avatar
 
Dries committed
24
25
26
27
28
29
30
31
  [uid] [int] NOT NULL ,
  [authname] [varchar] (128) NOT NULL ,
  [module] [varchar] (128) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[blocks] (
  [module] [varchar] (64) NOT NULL ,
Dries's avatar
   
Dries committed
32
  [delta] [varchar] (32) NOT NULL ,
Dries's avatar
 
Dries committed
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
  [status] [smallint] NOT NULL ,
  [weight] [smallint] NOT NULL ,
  [region] [smallint] NOT NULL ,
  [path] [varchar] (255) NOT NULL ,
  [custom] [smallint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[book] (
  [nid] [numeric](4, 0) NOT NULL ,
  [parent] [int] NOT NULL ,
  [weight] [smallint] NOT NULL ,
  [format] [smallint] NULL ,
  [log] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[boxes] (
  [bid] [smallint] NULL ,
  [title] [varchar] (64) NOT NULL ,
  [body] [text] NULL ,
  [info] [varchar] (128) NOT NULL ,
  [type] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[bundle] (
  [bid] [int] NULL ,
  [title] [varchar] (255) NOT NULL ,
  [attributes] [varchar] (255) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[cache] (
  [cid] [varchar] (255) NOT NULL ,
  [data] [text] NULL ,
  [expire] [int] NOT NULL ,
  [created] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[comments] (
  [cid] [int] NULL ,
  [pid] [int] NOT NULL ,
  [nid] [int] NOT NULL ,
  [uid] [int] NOT NULL ,
  [subject] [varchar] (64) NOT NULL ,
  [comment] [varchar] (8000) NOT NULL ,
  [hostname] [varchar] (128) NOT NULL ,
  [timestamp] [int] NOT NULL ,
  [link] [varchar] (16) NULL ,
  [score] [int] NOT NULL ,
  [status] [tinyint] NOT NULL ,
Dries's avatar
   
Dries committed
86
  [thread] [varchar] (255) NOT NULL ,
Dries's avatar
 
Dries committed
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
  [users] [varchar] (8000) NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[directory] (
  [link] [varchar] (255) NOT NULL ,
  [name] [varchar] (128) NOT NULL ,
  [mail] [varchar] (128) NOT NULL ,
  [slogan] [text] NOT NULL ,
  [mission] [text] NOT NULL ,
  [timestamp] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[feed] (
  [fid] [int] NULL ,
  [title] [varchar] (255) NOT NULL ,
  [url] [varchar] (255) NOT NULL ,
  [refresh] [int] NOT NULL ,
  [timestamp] [int] NULL ,
  [attributes] [varchar] (255) NULL ,
  [link] [varchar] (255) NULL ,
  [description] [varchar] (8000) NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[forum] (
  [nid] [numeric](10, 0) NOT NULL ,
  [tid] [numeric](10, 0) NOT NULL ,
Dries's avatar
Dries committed
116
  [icon] [varchar] (255) NULL ,
Dries's avatar
 
Dries committed
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
  [shadow] [numeric](10, 0) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[history] (
  [uid] [int] NOT NULL ,
  [nid] [int] NOT NULL ,
  [timestamp] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[item] (
  [iid] [int] NULL ,
  [fid] [int] NOT NULL ,
  [title] [varchar] (255) NOT NULL ,
  [link] [varchar] (255) NOT NULL ,
  [author] [varchar] (255) NOT NULL ,
  [description] [text] NOT NULL ,
  [timestamp] [int] NULL ,
  [attributes] [varchar] (255) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[locales] (
  [lid] [int] NULL ,
  [location] [varchar] (128) NOT NULL ,
  [string] [nvarchar] (4000) NOT NULL ,
  [da] [text] NULL ,
  [fi] [text] NULL ,
  [fr] [text] NULL ,
  [en] [text] NULL ,
  [es] [text] NULL ,
  [nl] [text] NULL ,
  [no] [text] NULL ,
  [sw] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[menu] (
  [name] [varchar] (255) NOT NULL ,
  [link] [varchar] (255) NOT NULL ,
  [help] [text] NULL ,
  [title] [varchar] (255) NOT NULL ,
  [parent] [varchar] (255) NOT NULL ,
  [weight] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[moderation_filters] (
  [fid] [numeric](10, 0) NULL ,
  [filter] [varchar] (255) NOT NULL ,
  [minimum] [smallint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[moderation_roles] (
  [rid] [numeric](4, 0) NOT NULL ,
  [mid] [numeric](4, 0) NOT NULL ,
  [value] [smallint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[moderation_votes] (
  [mid] [numeric](10, 0) NULL ,
  [vote] [varchar] (255) NULL ,
  [weight] [smallint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[node] (
  [nid] [numeric](10, 0) NULL ,
  [type] [varchar] (16) NOT NULL ,
  [title] [varchar] (128) NOT NULL ,
Dries's avatar
   
Dries committed
190
  [path] [varchar] (250) NULL ,
Dries's avatar
 
Dries committed
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
  [score] [int] NOT NULL ,
  [votes] [int] NOT NULL ,
  [uid] [int] NOT NULL ,
  [status] [int] NOT NULL ,
  [created] [int] NOT NULL ,
  [comment] [int] NOT NULL ,
  [promote] [int] NOT NULL ,
  [moderate] [int] NOT NULL ,
  [users] [text] NULL ,
  [attributes] [varchar] (255) NULL ,
  [teaser] [text] NOT NULL ,
  [body] [text] NOT NULL ,
  [changed] [int] NOT NULL ,
  [revisions] [text] NULL ,
  [static] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[page] (
  [nid] [numeric](10, 0) NOT NULL ,
  [link] [varchar] (128) NOT NULL ,
  [format] [smallint] NOT NULL ,
  [description] [varchar] (128) NOT NULL
) ON [PRIMARY]
GO

Dries's avatar
   
Dries committed
217
CREATE TABLE [dbo].[url_alias] (
Dries's avatar
   
Dries committed
218
219
220
221
222
223
  [pid] numeric (10, 0) NOT NULL,
  [dst] [varchar] (128) NOT NULL,
  [src] [varchar] (128) NOT NULL
) ON [PRIMARY]
GO

Dries's avatar
   
Dries committed
224
225
226
227
ALTER TABLE [dbo].[url_alias] WITH NOCHECK ADD
  CONSTRAINT [DF_[url_alias_pid] DEFAULT (0) FOR [pid],
  CONSTRAINT [DF_url_alias_dst] DEFAULT ('') FOR [dst],
  CONSTRAINT [DF_url_alias_src] DEFAULT ('') FOR [src]
Dries's avatar
   
Dries committed
228
229
GO

Dries's avatar
   
Dries committed
230
231
CREATE INDEX [url_alias_src_idx] ON [dbo].[url_alias]([src]) ON [PRIMARY]
CREATE INDEX url_alias_dst_idx ON url_alias(dst);
Dries's avatar
   
Dries committed
232
233
GO

Dries's avatar
 
Dries committed
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
CREATE TABLE [dbo].[permission] (
  [rid] [numeric](4, 0) NOT NULL ,
  [perm] [text] NULL ,
  [tid] [numeric](4, 0) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[poll] (
  [nid] [numeric](4, 0) NOT NULL ,
  [runtime] [int] NOT NULL ,
  [voters] [text] NOT NULL ,
  [active] [numeric](4, 0) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[poll_choices] (
  [chid] [numeric](10, 0) NULL ,
  [nid] [numeric](10, 0) NOT NULL ,
  [chtext] [varchar] (128) NOT NULL ,
  [chvotes] [int] NOT NULL ,
  [chorder] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[role] (
  [rid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
  [name] [varchar] (32) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[search_index] (
  [word] [varchar] (50) NOT NULL ,
  [lno] [numeric](10, 0) NOT NULL ,
  [type] [varchar] (16) NULL ,
  [count] [numeric](10, 0) NULL
) ON [PRIMARY]
GO

Dries's avatar
   
Dries committed
272
273
274
275
276
277
278
279
280
281
CREATE TABLE sessions (
  [sid] [varchar] (32) NOT NULL,
  [uid] [int] NOT NULL,
  [hostname] [varchar] (128) NOT NULL,
  [timestamp] [integer] NOT NULL,
  [session] [text],
) ON [PRIMARY]
GO


Dries's avatar
 
Dries committed
282
283
284
285
286
287
CREATE TABLE [dbo].[sequences] (
  [name] [varchar] (255) NOT NULL ,
  [id] [numeric](10, 0) NOT NULL
) ON [PRIMARY]
GO

Dries's avatar
   
Dries committed
288
CREATE TABLE [dbo].[node_counter] (
Dries's avatar
 
Dries committed
289
290
291
292
293
294
295
296
  [nid] [int] NOT NULL ,
  [totalcount] [numeric](20, 0) NOT NULL ,
  [daycount] [numeric](4, 0) NOT NULL ,
  [timestamp] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[system] (
Dries's avatar
   
Dries committed
297
298
299
300
  [filename] [varchar] (255) NOT NULL ,
  [name] [varchar] (255) NOT NULL ,
  [type] [varchar] (255) NOT NULL ,
  [description] [varchar] (255) NOT NULL ,
Dries's avatar
 
Dries committed
301
  [status] [int] NOT NULL
Dries's avatar
   
Dries committed
302
  [bootstrap] [int] NOT NULL
Dries's avatar
 
Dries committed
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[term_data] (
  [tid] [numeric](10, 0) NOT NULL ,
  [vid] [numeric](10, 0) NOT NULL ,
  [name] [varchar] (255) NOT NULL ,
  [description] [text] NULL ,
  [weight] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[term_hierarchy] (
  [tid] [numeric](4, 0) NOT NULL ,
  [parent] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[term_node] (
  [nid] [numeric](4, 0) NOT NULL ,
  [tid] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[term_relation] (
  [tid1] [numeric](4, 0) NOT NULL ,
  [tid2] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[term_synonym] (
  [tid] [numeric](10, 0) NOT NULL ,
  [name] [varchar] (255) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[users] (
Dries's avatar
   
Dries committed
340
  [uid] [numeric](10, 0) NULL ,
Dries's avatar
 
Dries committed
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
  [name] [varchar] (60) NOT NULL ,
  [pass] [varchar] (32) NOT NULL ,
  [mail] [varchar] (64) NULL ,
  [mode] [smallint] NOT NULL ,
  [sort] [smallint] NULL ,
  [threshold] [smallint] NULL ,
  [theme] [varchar] (255) NULL ,
  [signature] [varchar] (255) NULL ,
  [timestamp] [float] NOT NULL ,
  [status] [smallint] NOT NULL ,
  [timezone] [varchar] (8) NULL ,
  [language] [char] (2) NULL ,
  [init] [varchar] (128) NULL ,
  [data] [varchar] (8000) NULL ,
  [rid] [int] NOT NULL
Dries's avatar
   
Dries committed
356
357
)
--ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Dries's avatar
 
Dries committed
358
359
GO

Dries's avatar
Dries committed
360
361
362
363
364
365
CREATE TABLE [dbo].[users_uid_seq] (
  [id] [int] IDENTITY (1, 1) NOT NULL ,
  [vapor] [int] NULL
) ON [PRIMARY]
GO

Dries's avatar
 
Dries committed
366
CREATE TABLE [dbo].[variable] (
Dries's avatar
   
Dries committed
367
  [name] [varchar] (48) NOT NULL ,
Dries's avatar
 
Dries committed
368
369
370
371
372
373
374
375
376
377
378
379
  [value] [varchar] (8000) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[vocabulary] (
  [vid] [numeric](10, 0) NULL ,
  [name] [varchar] (255) NOT NULL ,
  [description] [text] NULL ,
  [relations] [tinyint] NOT NULL ,
  [hierarchy] [tinyint] NOT NULL ,
  [multiple] [tinyint] NOT NULL ,
  [required] [tinyint] NOT NULL ,
Dries's avatar
   
Dries committed
380
  [nodes] [text] NULL ,
Dries's avatar
 
Dries committed
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
  [weight] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[watchdog] (
  [wid] [int] IDENTITY (1, 1) NOT NULL ,
  [uid] [int] NOT NULL ,
  [type] [varchar] (16) NOT NULL ,
  [message] [text] NOT NULL ,
  [link] [varchar] (255) NOT NULL ,
  [location] [varchar] (128) NOT NULL ,
  [hostname] [varchar] (128) NOT NULL ,
  [timestamp] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[role] WITH NOCHECK ADD
  CONSTRAINT [PK_role] PRIMARY KEY  CLUSTERED
  (
    [rid]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[watchdog] WITH NOCHECK ADD
   PRIMARY KEY  CLUSTERED
  (
    [wid]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[cache] WITH NOCHECK ADD
  CONSTRAINT [DF_cache_created] DEFAULT (0) FOR [created]
GO

 CREATE  INDEX [forum_tid_idx] ON [dbo].[forum]([tid]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[node] WITH NOCHECK ADD
  CONSTRAINT [DF_node_score] DEFAULT (0) FOR [score],
  CONSTRAINT [DF_node_votes] DEFAULT (0) FOR [votes],
  CONSTRAINT [DF_node_uid] DEFAULT (0) FOR [uid],
  CONSTRAINT [DF_node_status] DEFAULT (1) FOR [status],
  CONSTRAINT [DF_node_created] DEFAULT (0) FOR [created],
  CONSTRAINT [DF_node_comment] DEFAULT (2) FOR [comment],
  CONSTRAINT [DF_node_promote] DEFAULT (0) FOR [promote],
  CONSTRAINT [DF_node_moderate] DEFAULT (0) FOR [moderate],
  CONSTRAINT [DF_node_changed] DEFAULT (0) FOR [changed],
  CONSTRAINT [DF_node_static] DEFAULT (0) FOR [static]
GO

 CREATE  INDEX [IX_role] ON [dbo].[role]([rid]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[term_data] WITH NOCHECK ADD
  CONSTRAINT [DF_term_data_vid] DEFAULT (0) FOR [vid]
GO

ALTER TABLE [dbo].[users] WITH NOCHECK ADD
  CONSTRAINT [DF_users_mode] DEFAULT (0) FOR [mode],
  CONSTRAINT [DF_users_sort] DEFAULT (0) FOR [sort],
Dries's avatar
   
Dries committed
441
442
443
444
445
446
447
448
449
  CONSTRAINT [DF_users_threshold] DEFAULT (0) FOR [threshold],
  CONSTRAINT [DF_users_status] DEFAULT (0) FOR [status],
  CONSTRAINT [DF_users_timestamp] DEFAULT (0) FOR [timestamp],
  CONSTRAINT [DF_users_rid] DEFAULT (0) FOR [rid],
  CONSTRAINT [DF_users_pass] DEFAULT ('') FOR [pass],
  CONSTRAINT [DF_users_homepage] DEFAULT ('') FOR [homepage],
  CONSTRAINT [DF_users_theme] DEFAULT ('') FOR [theme],
  CONSTRAINT [DF_users_signature] DEFAULT ('') FOR [signature],
  CONSTRAINT [DF_users_language] DEFAULT ('') FOR [language]
Dries's avatar
 
Dries committed
450
451
GO

Dries's avatar
   
Dries committed
452
 CREATE  INDEX [IX_sid] ON [dbo].[sessions]([sid]) ON [PRIMARY]
Dries's avatar
 
Dries committed
453
454
455
456
457
458
459
460
GO

 CREATE  INDEX [IX_users] ON [dbo].[users]([uid]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_timestamp] ON [dbo].[users]([timestamp]) ON [PRIMARY]
GO

Dries's avatar
   
Dries committed
461
 CREATE  INDEX [sessions_sid_idx] ON [dbo].[sessions]([sid]) ON [PRIMARY]
Dries's avatar
 
Dries committed
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
GO

 CREATE  INDEX [users_timestamp_idx] ON [dbo].[users]([timestamp]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[watchdog] WITH NOCHECK ADD
  CONSTRAINT [DF__watchdog__uid__41EDCAC5] DEFAULT ('0') FOR [uid],
  CONSTRAINT [DF__watchdog__type__42E1EEFE] DEFAULT ('') FOR [type],
  CONSTRAINT [DF__watchdog__messag__43D61337] DEFAULT ('') FOR [message],
  CONSTRAINT [DF__watchdog__link__44CA3770] DEFAULT ('') FOR [link],
  CONSTRAINT [DF__watchdog__locati__45BE5BA9] DEFAULT ('') FOR [location],
  CONSTRAINT [DF__watchdog__hostna__46B27FE2] DEFAULT ('') FOR [hostname],
  CONSTRAINT [DF__watchdog__timest__47A6A41B] DEFAULT ('0') FOR [timestamp]
GO

Dries's avatar
   
Dries committed
477
478
479
480
481
482
483
484
485
486
487
488
489
490
--
-- Insert some default values
--

INSERT INTO system VALUES ('modules/admin.module','admin','module','',1);
INSERT INTO system VALUES ('modules/block.module','block','module','',1);
INSERT INTO system VALUES ('modules/comment.module','comment','module','',1);
INSERT INTO system VALUES ('modules/help.module','help','module','',1);
INSERT INTO system VALUES ('modules/node.module','node','module','',1);
INSERT INTO system VALUES ('modules/page.module','page','module','',1);
INSERT INTO system VALUES ('modules/story.module','story','module','',1);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1);
INSERT INTO system VALUES ('themes/marvin/marvin.theme','marvin','theme','Internet explorer, Netscape, Opera',1);

Dries's avatar
   
Dries committed
491
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-27";');
Dries's avatar
   
Dries committed
492
493
INSERT INTO variable(name,value) VALUES('theme_default','s:6:"marvin";');

Dries's avatar
   
Dries committed
494
INSERT INTO users(uid,name,mail,rid) VALUES(0,'','','1');
Dries's avatar
   
Dries committed
495

Dries's avatar
   
Dries committed
496
497
498
INSERT INTO blocks(module,delta,status,custom,region,weight,path) VALUES('user', 0, 1, 0, 1, 0, '');
INSERT INTO blocks(module,delta,status,custom,region,weight,path) VALUES('user', 1, 1, 0, 1, 0, '');

Dries's avatar
   
Dries committed
499

Dries's avatar
 
Dries committed
500
501
502
503
---
--- Functions. Functions first available in SQL Server 2000. GREATEST() used by forum.module, tracker.module at the moment.
---

Dries's avatar
   
Dries committed
504
GO
Dries's avatar
 
Dries committed
505
506
507
508
509
510
511
512
CREATE FUNCTION GREATEST (@a int, @b  int)
RETURNS int AS
BEGIN
  IF (@a > @b)
  BEGIN
    RETURN @a;
  END
  RETURN @b;
Dries's avatar
   
Dries committed
513
END