• One other point is that if you use a unique constraint to function like a primary you MUST have the column defined as NOT NULL.

    create table dbo.Car (

    CarID int not null identity(1,1),

    VIN varchar(25) unique

    );

    go

    create unique clustered index CX_Car_CarID on dbo.Car

    (CarID)

    with (fillfactor=90);

    go

    insert Car

    select null

    select * from car

    Notice I removed the NOT NULL constraint on VIN. You can't make that mistake if you define the column as the primary key. If you don't specify your column will allow NULL.

    create table dbo.Car (

    CarID int not null identity(1,1),

    VIN varchar(25) unique

    );

    go

    create unique clustered index CX_Car_CarID on dbo.Car

    (CarID)

    with (fillfactor=90);

    go

    insert Car

    select null

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/