• john.arnott (10/22/2012)


    Try predicting the result of the final SELECT in this script:

    CREATE TABLE IdentTest

    ( --Ident INT NOT NULL IDENTITY (1,1)

    varfield varchar(100)

    )

    INSERT INTO IdentTest VALUES ('xyz')

    INSERT INTO IdentTest VALUES ('123')

    Select * from IdentTest

    ALTER TABLE IdentTest

    Add Ident INT IDENTITY (1,1)

    INSERT INTO IdentTest VALUES ('abc')

    SELECT Ident FROM IdentTest

    where varfield = 'abc'

    Make this more fun, make varfield a primary key.