Friday, February 24, 2012

DTS: excel to sql server

I posted this earlier, but it did not seem to get any views. Please help!

I'm trying to import an excel spreadsheet into SQL Server. I keep getting an error saying that 2 columns cannot except NULL values. Here's the setup of each file.

SQL TBL:
My table has 9 columns. the first column is a Primary Key and IDENTITY(1,1). My last column is a dateCreated column with a default of getDate(). Both values are set to NOT NULL. The 7 inside columns are just plain varChar datatypes.

XLS:
My spreadsheet has 7 columns which corelate to the 7 inside columns of my SQL TBL. I do not want to specify my first and last columns because they should be unique to the SQL TBL (identity and getDate()).

Any help with how to do this would be great. If you need more info, please let me know.

Thanks,
TimTim:

If this table is already full of data, edit the DTS package Transformation properties to NOT Copy to EITHER your PK or Date field.

Otherwise, if the table's empty, drop the PK & Date fields for the initial import THEN re-add them back.

Hope this helps

RobbieD

No comments:

Post a Comment