CREATE TABLE [dbo].[DataSyncERPAccount]
(
[ID] [int] NOT NULL IDENTITY(1, 1),
[DataSyncID] [int] NULL,
[DataSyncDefERPAccountID] [int] NULL,
[DevicesRequested] [int] NULL,
[DevicesMatched] [int] NULL,
[DevicesUpdated] [int] NULL,
[MetersRequested] [int] NULL,
[MetersMatched] [int] NULL,
[MetersSubmitted] [int] NULL,
[IsMapped] [bit] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DataSyncERPAccount] ADD CONSTRAINT [PK_DataSyncERPAccount_ID] PRIMARY KEY CLUSTERED ([ID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DataSyncERPAccount] ADD CONSTRAINT [FK_DataSyncERPAccount_DataSyncDefERPAccountID_DataSyncDefERPAccount_ID] FOREIGN KEY ([DataSyncDefERPAccountID]) REFERENCES [dbo].[DataSyncDefERPAccount] ([ID])
GO
ALTER TABLE [dbo].[DataSyncERPAccount] ADD CONSTRAINT [FK_DataSyncERPAccount_DataSyncID_DataSync_ID] FOREIGN KEY ([DataSyncID]) REFERENCES [dbo].[DataSync] ([ID]) ON DELETE CASCADE
GO