Home Forums SQL Server 2008 SQL Server Newbies IDENTITY_INSERT, and Using Alphanumeric Autoincrement Primary Key RE: IDENTITY_INSERT, and Using Alphanumeric Autoincrement Primary Key

  • kiran.vaichalkar (6/1/2013)


    Thanks Folks!!

    2nd question is now addressed

    an you also let me know what special we need to do to get the below executed correctly

    SET IDENTITY_INSERT USERS.ID ON

    Where USERS(ID INT PRIMARY KEY, Name nvarchar(20))

    I tried but it throws error saying, 'Either the object 'USERS' does not exist or you do not have permissions'

    Please Help..

    You don't set identity insert on the column, just the table.

    SET IDENTITY_INSERT USERS ON

    Then when you are done you need to set it back off.

    SET IDENTITY_INSERT USERS OFF

    _______________________________________________________________

    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/