Sunday, February 12, 2012
Adding an autonumber column after the fact?
I have a csv file of quotes. I need to IMPORT the quotes into my SQL Server database. I created the table with an autonumber identity column, but the IMPORT fails because I can't INSERT NULL into my identity column. There is no option to autonumber or anything when I click the TRANSFORM button on the IMPORT wizard. So, I have decided to allow NULLS on the ID column and add the numbering later. I'd rather not have to manually number it, is there a way to do it with a query? I treid just setting it to not allow NULLS and to auto-incrememnt, but that didn't work...I would have asked you to use temp table for the import and then do INSERT INTO a table with IDENTITY SET. Now you do ANSI SQL ALTER TABLE to SET IDENTITY on the table. Run a search of ALTER table in the BOL (books online). Hope this helps.|||Thank-you for your help :)|||I am glad I could help.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment