Wednesday, March 28, 2012

Problems importing data into sql server

I have a table for authors (for our bookstore) that has several fields
(firstname, lastname, etc.) and an author_id field (set as identity)

I'm trying to import a spreadsheet into this table, but keep getting
error messages that say I can't import data into the author_id field
(the identityf field).

Can someone suggest what I can do to overcome this?

Thanks,

Bill1) Import the data into a new flat table (ie: without indexes).
2) Run a report on the key field (identityf) -- there must be no duplicates.

select indentityf, count(*)
from newtable
group by identityf
having count(*)>1

should yield no results.

3) Correct the spreadsheet.
4) reimport the spreadsheet.

"Bill" <billzimmerman@.gospellight.com> wrote in message
news:8da5f4f4.0312091329.c066e47@.posting.google.co m...
> I have a table for authors (for our bookstore) that has several fields
> (firstname, lastname, etc.) and an author_id field (set as identity)
> I'm trying to import a spreadsheet into this table, but keep getting
> error messages that say I can't import data into the author_id field
> (the identityf field).
> Can someone suggest what I can do to overcome this?
> Thanks,
> Bill|||"Bill" <billzimmerman@.gospellight.com> wrote in message
news:8da5f4f4.0312091329.c066e47@.posting.google.co m...
> I have a table for authors (for our bookstore) that has several fields
> (firstname, lastname, etc.) and an author_id field (set as identity)
> I'm trying to import a spreadsheet into this table, but keep getting
> error messages that say I can't import data into the author_id field
> (the identityf field).
> Can someone suggest what I can do to overcome this?
<snip
Use the DTS. On the screen that allows you to select the tables, click the
Transform button. On this screem, you'll see 'Allow Identity Insert'.

BV
www.iheartmypond.comsql

No comments:

Post a Comment