Created
January 29, 2012 22:09
-
-
Save tawman/1700953 to your computer and use it in GitHub Desktop.
PetaPocoHierarchy Organization Table SQL CREATE Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE TABLE [dbo].[Organization]( | |
[Id] [uniqueidentifier] NOT NULL, | |
[ParentId] [uniqueidentifier] NULL, | |
[OrganizationCode] [nvarchar](10) NOT NULL, | |
[Name] [nvarchar](100) NOT NULL, | |
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
ALTER TABLE [dbo].[Organization] WITH CHECK ADD CONSTRAINT [FK_Organization_ParentOrganization] FOREIGN KEY([ParentId]) | |
REFERENCES [dbo].[Organization] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Organization] CHECK CONSTRAINT [FK_Organization_ParentOrganization] | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment