IF NOT EXISTS ( SELECT  *
                FROM    dbo.sysobjects
                WHERE   id = OBJECT_ID(N'[dbo].[SummaryFactors]')
                        AND OBJECTPROPERTY(id, N'IsTable') = 1 )
    BEGIN					

        CREATE TABLE [dbo].[SummaryFactors]
            (
              [Id] [UNIQUEIDENTIFIER] NOT NULL ,
              [Kind] [TINYINT] NOT NULL ,
              [PersonCode] [VARCHAR](5) NULL ,
              [FactorDate] [dbo].[UserTarikh] NULL ,
              [StoreCode] [VARCHAR](3) NULL ,
              [SyncTime] [DATETIME] NULL ,
              CONSTRAINT [PK_SummaryFactors] 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].[SummaryFactors] ADD  CONSTRAINT [DF_SummaryFactors_Id]  DEFAULT (NEWID()) FOR [Id];

    END;
    