if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GiftTokenTransactionsXTab]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[GiftTokenTransactionsXTab]
(
	[FK_OriginalGlobalTransactionNumber] [int] NOT NULL,
	[FK_GiftTokenId] [int] NOT NULL,
 CONSTRAINT [PK_GiftTokenTransactionsXTab] PRIMARY KEY CLUSTERED 
(
	[FK_OriginalGlobalTransactionNumber] ASC,
	[FK_GiftTokenId] ASC
)
)
GO

IF NOT EXISTS
(
  SELECT SysColumns.Name 
  FROM SysObjects(NOLOCK) 
    INNER JOIN SysColumns(NOLOCK) ON SysColumns.Id = SysObjects.ID 
    AND SysColumns.Name = 'FK_GlobalGiftTokenHotelId'
    WHERE SysObjects.Name = 'GiftTokenType'
)
  ALTER TABLE GiftTokenType ADD FK_GlobalGiftTokenHotelId INT NULL 
GO

IF NOT EXISTS
(
  SELECT SysColumns.Name 
  FROM SysObjects(NOLOCK) 
    INNER JOIN SysColumns(NOLOCK) ON SysColumns.Id = SysObjects.ID 
    AND SysColumns.Name = 'GiftTokenNumber2'
    WHERE SysObjects.Name = 'GiftToken'
)
  ALTER TABLE GiftToken ADD GiftTokenNumber2 VARCHAR(50) NULL 
GO

IF NOT EXISTS
(
  SELECT SysColumns.Name 
  FROM SysObjects(NOLOCK) 
    INNER JOIN SysColumns(NOLOCK) ON SysColumns.Id = SysObjects.ID 
    AND SysColumns.Name = 'GlobalGiftTokenHotelId'
    WHERE SysObjects.Name = 'Customer'
)
  ALTER TABLE Customer ADD GlobalGiftTokenHotelId INT NULL 
GO


