Be careful with Open Table
Yes, you were already aware of 40 or 50 reasons not to use Open Table. I have one more. Say you are creating a table with a composite key that includes a binary column. An example I came across recently was a table that captures additional data not covered by CDC (e.g. username). So, I created this table:
CREATE TABLE dbo.CaptureDetails
StartLSN BINARY(10) NOT NULL,
EndLSN BINARY(10) NOT NULL,
ActionType INT NOT NULL,
Username VARCHAR(32) NOT NULL,
PRIMARY KEY(StartLSN, EndLSN, ActionType)
— now I actually use cdc schema not of dbo, and populate
— this via a trigger on the CDC change table, but for ease
— of reproduction, let's just jimmy some data in there:
INSERT dbo.CaptureDetails(StartLSN, EndLSN, ActionType, Username)
SELECT 0x0000001A000001360013, 0x0000001A000001360012, 2, 'sa'
UNION SELECT 0x0000001A0000013A0003, 0x0000001A0000013A0002, 2, 'sa'
UNION SELECT 0x0000001A0000013B0004, 0x0000001A0000013B0002, 3, 'sa'
UNION SELECT 0x0000001A0000013B0004, 0x0000001A0000013B0002, 4, 'sa'
UNION SELECT 0x0000001A000001490013, 0x0000001A000001490012, 2, 'sa'
UNION SELECT 0x0000001A0000014C0003, 0x0000001A0000014C0002, 2, 'sa'
UNION SELECT 0x0000001A000001560003, 0x0000001A000001560002, 2, 'sa'
UNION SELECT 0x0000001A000001570003, 0x0000001A000001570002, 2, 'sa'
UNION SELECT 0x0000001A000001590004, 0x0000001A000001590002, 3, 'sa';
I have filed this defect (with a few more details) at the following URL, and encourage you to vote: