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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autofill an Integer Column

Status
Not open for further replies.

mekohler

Technical User
May 4, 2007
64
CA
Hi, I'm importing a table from another data source, deleting an existing table in a SQL database and replacing the data with the new imported data. My problem is that in the destination table there needs to have a primary key, an integer column. Is there a way that when I'm exporting the new data to the destination table that I could populate an integer column with a random number or auto number?
Thanks,
Michael
 
Easiest way is to change that primary key to be a identity one, and change it back once load finished

Failing that.

option 2 - not feasible if volumes are high
insert into a temp table with the field defined as identity and then insert into final table

option 3 - add a transform step to your dataflow and add a incremental value to that column

option 4 - on the data source, if it is a SQL db, join your source data with a numbers table and use that as the required number


Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Thanks, for the reply. Can you tell me how to change the primary key to an identity one?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top