- auditexample.zip
- AuditExample
- Acme.AuditExample.EFDAL
- Acme.AuditExample.Install
- Acme.AuditExample
- AuditConsole
- AuditExample.sln
- AuditExample.wsgen
- AuditExample.wsgen.info
- bin
|
--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.
--Data Schema For Version 1.0.0.0
--Generated on 2010-07-21 20:57:25
--CREATE TABLE [Customer]
if not exists(select * from sysobjects where name = 'Customer' and xtype = 'U')
CREATE TABLE [dbo].[Customer] (
[CustomerId] [UniqueIdentifier] NOT NULL ,
[Name] [VarChar] (100) NULL ,
[ModifiedBy] [Varchar] (50) NULL ,
[ModifiedDate] [DateTime] CONSTRAINT [DF__CUSTOMER_MODIFIEDDATE] DEFAULT getutcdate() NULL ,
[CreatedBy] [Varchar] (50) NULL ,
[CreatedDate] [DateTime] CONSTRAINT [DF__CUSTOMER_CREATEDDATE] DEFAULT getutcdate() NULL ,
[TimeStamp] [timestamp] NOT NULL
) ON [PRIMARY]
GO
--CREATE AUDIT TABLE FOR [Customer]
if not exists(select * from sysobjects where name = '__AUDIT__Customer' and xtype = 'U')
CREATE TABLE [dbo].[__AUDIT__Customer] (
[__rowid] [INT] NOT NULL IDENTITY,
[__action] [INT] NOT NULL,
[__insertdate] [DateTime] CONSTRAINT [DF__Customer__AUDIT] DEFAULT getutcdate() NOT NULL,
[ModifiedBy] [Varchar] (50) NULL,
[CustomerId] [UniqueIdentifier] NULL,
[Name] [VarChar] (100) NULL
) ON [PRIMARY]
GO
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'CustomerId' and o.name = '__AUDIT__Customer')
ALTER TABLE [dbo].[__AUDIT__Customer] ADD [CustomerId] [UniqueIdentifier] NULL
GO
ALTER TABLE [dbo].[__AUDIT__Customer] ALTER COLUMN [CustomerId] [UniqueIdentifier] NULL
GO
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'Name' and o.name = '__AUDIT__Customer')
ALTER TABLE [dbo].[__AUDIT__Customer] ADD [Name] [VarChar] (100) NULL
GO
ALTER TABLE [dbo].[__AUDIT__Customer] ALTER COLUMN [Name] [VarChar] (100) NULL
GO
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'ModifiedBy' and o.name = '__AUDIT__Customer')
ALTER TABLE [dbo].[__AUDIT__Customer] ADD [ModifiedBy] [Varchar] (50) NULL
GO
ALTER TABLE [dbo].[__AUDIT__Customer] ALTER COLUMN [ModifiedBy] [Varchar] (50) NULL
GO
--APPEND AUDIT TRAIL CREATE for Table [Customer]
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'CreatedBy' and o.name = 'Customer')
ALTER TABLE [dbo].[Customer] ADD [CreatedBy] [Varchar] (50) NULL
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'CreatedDate' and o.name = 'Customer')
ALTER TABLE [dbo].[Customer] ADD [CreatedDate] [DateTime] CONSTRAINT [DF__CUSTOMER_CREATEDDATE] DEFAULT getutcdate() NULL
--APPEND AUDIT TRAIL MODIFY for Table [Customer]
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'ModifiedBy' and o.name = 'Customer')
ALTER TABLE [dbo].[Customer] ADD [ModifiedBy] [Varchar] (50) NULL
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'ModifiedDate' and o.name = 'Customer')
ALTER TABLE [dbo].[Customer] ADD [ModifiedDate] [DateTime] CONSTRAINT [DF__CUSTOMER_MODIFIEDDATE] DEFAULT getutcdate() NULL
--APPEND AUDIT TRAIL TIMESTAMP for Table [Customer]
if not exists (select * from syscolumns c inner join sysobjects o on c.id = o.id where c.name = 'TimeStamp' and o.name = 'Customer')
ALTER TABLE [dbo].[Customer] ADD [TimeStamp] [timestamp] NOT NULL
--PRIMARY KEY FOR TABLE [Customer]
if not exists(select * from sysobjects where name = 'PK_CUSTOMER' and xtype = 'PK')
ALTER TABLE [dbo].[Customer] WITH NOCHECK ADD
CONSTRAINT [PK_CUSTOMER] PRIMARY KEY CLUSTERED
(
[CustomerId]
) ON [PRIMARY]
GO
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.