IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[PersonnelMailServer]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[PersonnelMailServer](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[FK_UserIDNumber] [int] NOT NULL,
	[MailServerType] [int] NOT NULL,
	[AccessToken] [varbinary](max) NULL,
	[AccessTokenExpires] [datetime] NULL,
	[LastUpdDatestamp] [datetime] NOT NULL,
    CONSTRAINT [PK_PersonnelMailServer] PRIMARY KEY CLUSTERED 
    (
	  [ID] ASC,
	  [FK_UserIDNumber] ASC,
	  [MailServerType] ASC
    )
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

  ALTER TABLE [dbo].[PersonnelMailServer] ADD  DEFAULT (getdate()) FOR [LastUpdDatestamp]
END
GO


