USE [EnVisage]
GO


IF (EXISTS (SELECT * FROM sys.tables where name='Tag'))
BEGIN
ALTER TABLE [dbo].[Tag] DROP CONSTRAINT [DF_Tag_Id]
DROP TABLE [dbo].[Tag]
END


CREATE TABLE [dbo].[Tag](
	[Id] [uniqueidentifier] NOT NULL,
	[TagType] [int] NOT NULL,
	[TagName] [nvarchar](100) NOT NULL,
	[TagColor] [nvarchar](128) NULL,
	[timestamp] [timestamp] NOT NULL,
 CONSTRAINT [PK_Tag] 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]


ALTER TABLE [dbo].[Tag] ADD  CONSTRAINT [DF_Tag_Id]  DEFAULT (newid()) FOR [Id]


