IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'ExternalReference')
BEGIN
CREATE TABLE [dbo].[ExternalReference](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ParentID] [int] NULL,
	[Qualifier] [varchar](100) NOT NULL,
	[Value] [varchar](8000) NOT NULL,
 CONSTRAINT [PK_ExternalReference] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]


ALTER TABLE [dbo].[ExternalReference]  WITH NOCHECK ADD  CONSTRAINT [FK_ExternalReference_ExternalReference] FOREIGN KEY([ParentID])
REFERENCES [dbo].[ExternalReference] ([ID])
END

