IF EXISTS
(
  SELECT SysObjects.Name 
  FROM SysObjects WITH (NOLOCK) 
    
    WHERE SysObjects.Name = 'OnlineImageURL'
) AND NOT EXISTS 
(SELECT SysColumns.Name 
  FROM SysObjects WITH (NOLOCK) 
    INNER JOIN SysColumns WITH (NOLOCK) ON SysColumns.Id = SysObjects.ID 
    AND SysColumns.Name = 'ID'
    WHERE SysObjects.Name = 'OnlineImageURL'
)
	DROP TABLE OnlineImageURL
GO
IF NOT EXISTS
(
  SELECT SysObjects.Name 
  FROM SysObjects WITH (NOLOCK) 
    
    WHERE SysObjects.Name = 'OnlineImageURL'
) 
BEGIN
	CREATE TABLE [dbo].[OnlineImageURL](
		[ID] [int] IDENTITY(1,1) NOT NULL,
		[FK_Key] [int] NOT NULL,
		[ImageType] [int] NOT NULL,
		[URL] [varchar](500) NULL,
		[URLDescription] [varchar](500) NULL,
	CONSTRAINT [PK_OnlineImageURL] PRIMARY KEY CLUSTERED 
	(
		[ID] ASC
	)
	) ON [PRIMARY]

	CREATE UNIQUE NONCLUSTERED INDEX [UIX_OnlineImageURL_1] ON [dbo].[OnlineImageURL]
	(
		[FK_Key] ASC,
		[ImageType] ASC
	)
END
	GO