Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 import from excel - skip identity

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2004-10-24 : 03:30:54
I have a table with 3 fields -- id, areacode, timezone. id is an identity -autoincrement
I want to import an excel file with 2 fields areacode and timezone. when using dts I am getting an error that ID can't be blank. I don't want it to be blank - I want sql server to insert the identity id.
What am I doing wrong?

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-10-24 : 07:08:43
identity fields are populated automatically. Don't import into the column. I don't know how to do that with DTS (I have never used it) but using bulk copy I would do this

create view v_mytable as
select areacode, timecode from mytable

then insert into v_mytable. I'm sure DTS would work the same way if no one else comes along and says how to exclude a column.

--Ken
I want to die in my sleep like my grandfather, not screaming in terror like his passengers.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-10-24 : 11:11:13
When you get to the "Select Source Tables and Views" choose the Source Excel sheet and the Destination Table and then press the "Transform" [...] button.

In the list of columns set the "Source" column to "<ignore>" for your ID column, and make sure the areacode and timezone [source] columns are going into the appropriate destination columns.

You should be in business!

Kristen
Go to Top of Page
   

- Advertisement -