IF Not (EXISTS(SELECT * FROM sysobjects WHERE name='UserHistory'))
Begin
CREATE TABLE [dbo].[UserHistory](
	[Id] [UNIQUEIDENTIFIER] NOT NULL,
	[UserId] [SMALLINT] NOT NULL,
	[Station] [SMALLINT] NULL,
        [FiscalYear] [INT] NOT NULL,
	[StartDate] [DATETIME] NOT NULL,
	[EndDate] [DATETIME] NULL,
	[SystemName] [VARCHAR](50) NOT NULL,
	[CreateOn] [DATETIME] NOT NULL,
 CONSTRAINT [PK_UserHistory] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)
) ON [PRIMARY]

ALTER TABLE [dbo].[UserHistory] ADD  CONSTRAINT [DF_UserHistory_Id]  DEFAULT (NEWID()) FOR [Id]
ALTER TABLE [dbo].[UserHistory] ADD  CONSTRAINT [DF_UserHistory_CreateOn]  DEFAULT (GETDATE()) FOR [CreateOn]
End
