if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CategoryGroupType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[CategoryGroupType](
	[PK_CategoryTypeNumber] [int] IDENTITY(1,1) NOT NULL,
	[TypeNumber] [int] NOT NULL,
	[Name] [varchar](255) NOT NULL,
	[IsPermanent] [bit] NOT NULL
) ON [PRIMARY]
GO


IF NOT EXISTS (SELECT * FROM CategoryGroupType WITH (NOLOCK) WHERE TypeNumber = 0)
  INSERT INTO CategoryGroupType (TypeNumber,Name,IsPermanent) VALUES (0,'Unknown',1);
IF NOT EXISTS (SELECT * FROM CategoryGroupType WITH (NOLOCK) WHERE TypeNumber = 1)
  INSERT INTO CategoryGroupType (TypeNumber,Name,IsPermanent) VALUES (1,'Sales',1);
IF NOT EXISTS (SELECT * FROM CategoryGroupType WITH (NOLOCK) WHERE TypeNumber = 2)
  INSERT INTO CategoryGroupType (TypeNumber,Name,IsPermanent) VALUES (2,'Cleaning',1);
IF NOT EXISTS (SELECT * FROM CategoryGroupType WITH (NOLOCK) WHERE TypeNumber = 3)
  INSERT INTO CategoryGroupType (TypeNumber,Name,IsPermanent) VALUES (3,'Staff',1);
GO
