annotate OslFileMonitorService/DatabaseScript.sql @ 121:8f94475d3146 tip

final code
author stevenh7776
date Thu, 31 May 2012 15:35:26 +0100
parents e84dc4926a5a
children
rev   line source
88
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
1 USE [master]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
2 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
3 /****** Object: Database [FileMonitoring] Script Date: 01/13/2011 19:12:24 ******/
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
4 CREATE DATABASE [FileMonitoring]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
5 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 USE [FileMonitoring]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8 /****** Object: Table [dbo].[FileEvents] Script Date: 01/13/2011 19:12:25 ******/
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 SET ANSI_NULLS ON
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 SET QUOTED_IDENTIFIER ON
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 SET ANSI_PADDING ON
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 CREATE TABLE [dbo].[FileEvents](
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16 [Id] [int] IDENTITY(1,1) NOT NULL,
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17 [FileEvent] [varchar](50) NOT NULL,
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 [CreateTimestamp] [smalldatetime] NULL,
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
19 CONSTRAINT [PK_FileEvents] PRIMARY KEY CLUSTERED
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
20 (
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
21 [Id] ASC
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
22 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
23 ) ON [PRIMARY]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
24 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25 SET ANSI_PADDING OFF
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
26 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
27 /****** Object: StoredProcedure [dbo].[FileEvents_insert] Script Date: 01/13/2011 19:12:31 ******/
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 SET ANSI_NULLS ON
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 SET QUOTED_IDENTIFIER ON
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
31 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
32 -- =============================================
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
33 -- Author: OSL
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
34 -- Create date: 12/01/2011
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
35 -- Description: Demo for OSL
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
36 -- =============================================
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
37 CREATE PROCEDURE [dbo].[FileEvents_insert]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
38 -- Add the parameters for the stored procedure here
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
39 @FileEvent VARCHAR(50), @Id INT OUTPUT
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
40 AS
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
41 BEGIN
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
42 SET NOCOUNT ON;
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
43
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
44 -- Insert statements for procedure here
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
45 INSERT dbo.FileEvents (FileEvent) SELECT @FileEvent
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
46
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
47 SELECT @Id = SCOPE_IDENTITY()
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
48 END
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
49 GO
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
50 /****** Object: Default [DF_FileEvents_CreateTimestamp] Script Date: 01/13/2011 19:12:25 ******/
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
51 ALTER TABLE [dbo].[FileEvents] ADD CONSTRAINT [DF_FileEvents_CreateTimestamp] DEFAULT (getdate()) FOR [CreateTimestamp]
e84dc4926a5a OSL work from 2011
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
52 GO