Hello Lukas,
– Table Trans_MediaCode
CREATE TABLE [Trans_MediaCode]
(
[PK_Trans_MediaCode] Bigint IDENTITY NOT NULL,
[MediaCode] Varchar(128) NOT NULL,
[Product_ID] Int DEFAULT 0 NOT NULL
)
go
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMBC’, 1);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMBCNM’, 2);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMCL’, 3);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMCLNM3’, 4);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMGSP’, 5);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMGSPNM’, 6);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘BMCLNM’, 7);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MVGL1’, 8);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MVGL1_RTL’, 9);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MVGL1_UNI’, 10);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MVGL1_OMB’, 11);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MVGL1_MD’, 16);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MLAT’, 19);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MLEKAT’, 20);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MAPSL1’, 21);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MGSSGC’, 22);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MGSSP’, 23);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MGSSPM’, 24);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MGSSDUG’, 25);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MGSS2490’, 26);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘MGSS7470’, 27);
INSERT INTO Trans_MediaCode (MediaCode, Product_ID) VALUES (‘GTAT’, 147);
– Add keys for table Trans_MediaCode
ALTER TABLE [Trans_MediaCode] ADD CONSTRAINT [PK_Trans_MediaCode] PRIMARY KEY NONCLUSTERED ([PK_Trans_MediaCode])
go
ALTER TABLE [Trans_MediaCode] ADD CONSTRAINT [Trans_MediaCode_Product_ID] UNIQUE ([Product_ID])
go
ALTER TABLE [Trans_MediaCode] ADD CONSTRAINT [Trans_MediaCode_MediaCode] UNIQUE ([MediaCode])
go
The problem is, the keys are coming after the “After Script”
IKrischer