• sknox (9/24/2010)


    So that gives us 2 identifier columns, remarkably similar to the two in this QotD -- and that's where you may have a point. But I'd caution here as well. First, we need to know why that surrogate UID is there.

    No, this QotD only has one identifier:

    OrderRefNo UNIQUEIDENTIFIER NOT NULL CONSTRAINT DF_OrderRefNo DEFAULT NEWID() CONSTRAINT PK_Order PRIMARY KEY CLUSTERED,

    The other column, OrderNo, wouldn't qualify as a surrogate key or identifier in my book:

    OrderNo INT NOT NULL IDENTITY(1,1),

    The reason is there is no INDEX or CONSTRAINT that prevents duplicate values. Essentially is it just an INT field with a DEFAULT that creates sequential numbers, but someone can easily add rows with duplicate values.