Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to designate primary key in imported table

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
0
0
US
I have a table created by being imported from a text file. The original table has a column that contains the primary key for the table. Now that the table has been imported, Sql Server will not allow me to designate that column as the primary key. I guess I could create a new primary key column and populate it etc, but i have several dozen tables I'll be importing and I was hoping there would be an easy way to keep the old primary key columns without having to re-create them. Can anybody give me any easy way to accomplish this?
 
On the "Select Source Tables and Views" there is an Edit Mappings button.
On the "Column Mappings" popup there is an "Enable Identity Insert" option.

Lodlaiden

If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
I found the problem. I had to go into Management Studio - Tools - Options and uncheck a box : "Prevent saving changes that require table re-creation" Once that was done I could create the primary key and set the Identity Specification properly.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top