CREATE TABLE [dbo].[SCReportRepairCodes]
(
[ReportID] [int] NOT NULL,
[RepairCodeID] [int] NOT NULL,
[CreatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_SCReportRepairCodes_CreateDate] DEFAULT (getdate()),
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_SCReportRepairCodes_LastUpdate] DEFAULT (getdate()),
[timestamp] [timestamp] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SCReportRepairCodes] ADD CONSTRAINT [PK_SCReportRepairCodes] PRIMARY KEY CLUSTERED ([ReportID], [RepairCodeID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SCReportRepairCodes] ADD CONSTRAINT [FK_SCReportRepairCodes_RepairCodeID_SCRepairCodes] FOREIGN KEY ([RepairCodeID]) REFERENCES [dbo].[SCRepairCodes] ([RepairCodeID])
GO
ALTER TABLE [dbo].[SCReportRepairCodes] ADD CONSTRAINT [FK_SCReportRepairCodes_ReportID_SCReports] FOREIGN KEY ([ReportID]) REFERENCES [dbo].[SCReports] ([ReportID])
GO