Bug_Tracker (система эксплуатации программ) - создание таблиц в базе.

   1:  SET ANSI_NULLS ON
   2:  GO
   3:  SET QUOTED_IDENTIFIER ON
   4:  GO
   5:  CREATE TABLE [dbo].[Projects](
   6:      [id] [uniqueidentifier] NOT NULL,
   7:      [URL] [nvarchar](250) NOT NULL,
   8:      [Name] [nvarchar](250) NOT NULL,
   9:      [IsPublic] [bit] NOT NULL,
  10:   CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED 
  11:  (
  12:      [id] ASC
  13:  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  14:  ) ON [PRIMARY]
  15:  GO
  16:   
  17:  SET ANSI_NULLS ON
  18:  GO
  19:  SET QUOTED_IDENTIFIER ON
  20:  GO
  21:  SET ANSI_PADDING ON
  22:  GO
  23:  CREATE TABLE [dbo].[ParmProtector8](
  24:      [i] [int] IDENTITY(1,1) NOT NULL,
  25:      [key] [binary](8) NOT NULL,
  26:      [IV] [binary](8) NOT NULL,
  27:      [Date] [datetime] NOT NULL,
  28:   CONSTRAINT [PK_ParmProtector8] PRIMARY KEY CLUSTERED 
  29:  (
  30:      [i] ASC
  31:  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  32:  ) ON [PRIMARY]
  33:  GO
  34:  SET ANSI_PADDING OFF
  35:  GO
  36:   
  37:  SET ANSI_NULLS ON
  38:  GO
  39:  SET QUOTED_IDENTIFIER ON
  40:  GO
  41:  CREATE TABLE [dbo].[BugState](
  42:      [i] [int] IDENTITY(1,1) NOT NULL,
  43:      [Image] [nvarchar](1000) NOT NULL,
  44:      [Descr] [nvarchar](4000) NOT NULL,
  45:   CONSTRAINT [PK_BugState] PRIMARY KEY CLUSTERED 
  46:  (
  47:      [i] ASC
  48:  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  49:  ) ON [PRIMARY]
  50:  GO
  51:   
  52:  SET ANSI_NULLS ON
  53:  GO
  54:  SET QUOTED_IDENTIFIER ON
  55:  GO
  56:  CREATE TABLE [dbo].[Bugs](
  57:      [i] [int] IDENTITY(1,1) NOT NULL,
  58:      [ToProducts] [uniqueidentifier] NOT NULL,
  59:      [ToState] [int] NOT NULL,
  60:      [TXT] [nvarchar](4000) NULL,
  61:      [Page] [nvarchar](1000) NULL,
  62:      [ToImage] [nvarchar](1000) NULL,
  63:      [CrDate] [datetime] NOT NULL,
  64:      [ToUser] [uniqueidentifier] NOT NULL,
  65:   CONSTRAINT [PK_Bugs] PRIMARY KEY CLUSTERED 
  66:  (
  67:      [i] ASC
  68:  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  69:  ) ON [PRIMARY]
  70:  GO
  71:   
  72:  SET ANSI_NULLS ON
  73:  GO
  74:  SET QUOTED_IDENTIFIER ON
  75:  GO
  76:  CREATE TABLE [dbo].[BugComment](
  77:      [i] [int] IDENTITY(1,1) NOT NULL,
  78:      [ToBug] [int] NOT NULL,
  79:      [ToUser] [uniqueidentifier] NOT NULL,
  80:      [Date] [datetime] NOT NULL,
  81:      [NewState] [int] NOT NULL,
  82:      [ToImage] [nvarchar](1000) NULL,
  83:      [Comment] [nvarchar](4000) NULL,
  84:   CONSTRAINT [PK_BugForum] PRIMARY KEY CLUSTERED 
  85:  (
  86:      [i] ASC
  87:  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  88:  ) ON [PRIMARY]
  89:  GO
  90:   
  91:  ALTER TABLE [dbo].[BugComment]  WITH CHECK ADD  CONSTRAINT [FK_BugComment_aspnet_Membership] FOREIGN KEY([ToUser])
  92:  REFERENCES [dbo].[aspnet_Membership] ([UserId])
  93:  GO
  94:  ALTER TABLE [dbo].[BugComment] CHECK CONSTRAINT [FK_BugComment_aspnet_Membership]
  95:  GO
  96:   
  97:  ALTER TABLE [dbo].[BugComment]  WITH CHECK ADD  CONSTRAINT [FK_BugForum_Bugs] FOREIGN KEY([ToBug])
  98:  REFERENCES [dbo].[Bugs] ([i])
  99:  GO
 100:  ALTER TABLE [dbo].[BugComment] CHECK CONSTRAINT [FK_BugForum_Bugs]
 101:  GO
 102:   
 103:  ALTER TABLE [dbo].[BugComment]  WITH CHECK ADD  CONSTRAINT [FK_BugForum_BugState1] FOREIGN KEY([NewState])
 104:  REFERENCES [dbo].[BugState] ([i])
 105:  GO
 106:  ALTER TABLE [dbo].[BugComment] CHECK CONSTRAINT [FK_BugForum_BugState1]
 107:  GO
 108:   
 109:  ALTER TABLE [dbo].[Bugs]  WITH CHECK ADD  CONSTRAINT [FK_Bugs_aspnet_Membership] FOREIGN KEY([ToUser])
 110:  REFERENCES [dbo].[aspnet_Membership] ([UserId])
 111:  GO
 112:  ALTER TABLE [dbo].[Bugs] CHECK CONSTRAINT [FK_Bugs_aspnet_Membership]
 113:  GO
 114:   
 115:  ALTER TABLE [dbo].[Bugs]  WITH CHECK ADD  CONSTRAINT [FK_Bugs_BugState] FOREIGN KEY([ToState])
 116:  REFERENCES [dbo].[BugState] ([i])
 117:  GO
 118:  ALTER TABLE [dbo].[Bugs] CHECK CONSTRAINT [FK_Bugs_BugState]
 119:  GO
 120:   
 121:  ALTER TABLE [dbo].[Bugs]  WITH CHECK ADD  CONSTRAINT [FK_Bugs_Products] FOREIGN KEY([ToProducts])
 122:  REFERENCES [dbo].[Projects] ([id])
 123:  GO
 124:  ALTER TABLE [dbo].[Bugs] CHECK CONSTRAINT [FK_Bugs_Products]
 125:  GO


Comments ( )
Link to this page: //www.vb-net.com/Bug_Tracker/CreateTable.htm
< THANKS ME>