Declare @TaskCatJob as int = (Select Count(*) FROM [dbo].[pal_TaskCategory] Where taskCategory = 'Job Card')
IF @TaskCatJob = 0
BEGIN
INSERT INTO [dbo].[pal_TaskCategory]
           ([taskCategory]
           ,[isActive])
     VALUES
           ('Job Card'
           ,'1')
END

Declare @TaskTypeJob as int = (Select Count(*) FROM [dbo].[pal_TaskType] Where taskCategoryId = 4)
IF @TaskTypeJob = 0
BEGIN
INSERT INTO [dbo].[pal_TaskType]
           ([taskCategoryId], [taskType]
           ,[isActive])
     VALUES
           (4, 'Hardware'
           ,'1')
END

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'categoryId'
      AND Object_ID = Object_ID(N'pal_Project'))
BEGIN
    ALTER TABLE pal_Project
	ADD categoryId int NULL; 
END




