Solved

SQL Server 2005 - SSIS using Excel to a Table

Posted on 2006-11-06
6
4,453 Views
Last Modified: 2008-01-09
I'm using SQL Server 2005 and I have created a SSIS package - I'm trying to take a
excel spreadsheet with three columns and place it into my database table and I'm getting the following errors which I can't for the life of me debug:

TITLE: Package Validation Error
------------------------------

Package Validation Error

------------------------------
ADDITIONAL INFORMATION:

Error at Data Flow Task [SQL Server Destination [14]]: The column "Account" can't be inserted because the conversion between types DT_R8 and DT_NUMERIC is not supported.

Error at Data Flow Task [SQL Server Destination [14]]: Columns "Description" and "description" cannot convert between unicode and non-unicode string data types.

Error at Data Flow Task [SQL Server Destination [14]]: Columns "Short Description" and "short_desc" cannot convert between unicode and non-unicode string data types.

Error at Data Flow Task [DTS.Pipeline]: "component "SQL Server Destination" (14)" failed validation and returned validation status "VS_ISBROKEN".

Error at Data Flow Task [DTS.Pipeline]: One or more component failed validation.

Error at Data Flow Task: There were errors during task validation.

 (Microsoft.DataTransformationServices.VsIntegration)

------------------------------
BUTTONS:

OK
------------------------------


Now the table I'm trying to push the excel data into looks was created via the following script:

create table acct_data
(
      acct INT,      
      description VARCHAR,
      short_desc VARCHAR
)


Additionally, the actual Excel data is in the following format
(only posted the heading columns and the first two rows - the other 1400 + rows looks the same):

Account      Description       Short Description
100001      Petty Cash       Operating Cash  Croix
100002      Petty Cash       Operating Cash  St Thomas


Any help how to get this simple Excel sheet into my SQL Server 2005 DB would be great!
0
Comment
Question by:kpu8
  • 3
  • 3
6 Comments
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 17887916
Change the acct field datatype to nvarchar

Change the other fields to nvarchar also

This will at least let you import the data.

Then you may need to write a stored proc to copy from your stagng to table to the real table.




If you want to try and do it all in SSIS,

This page:

http://www.sqldts.com/default.aspx?254

sheds some light on why it thinks your acccount column is varchar.

How you implement that particular solution in SSIS, I'm not too sure.
0
 
LVL 1

Author Comment

by:kpu8
ID: 17895204
Well with having all the fields set to nvarchar now I get the following new errors:


TITLE: Package Validation Error
------------------------------

Package Validation Error

------------------------------
ADDITIONAL INFORMATION:

Error at Data Flow Task [SQL Server Destination [14]]: The column "Account" can't be inserted because the conversion between types DT_R8 and DT_WSTR is not supported.

Error at Data Flow Task [DTS.Pipeline]: "component "SQL Server Destination" (14)" failed validation and returned validation status "VS_ISBROKEN".

Error at Data Flow Task [DTS.Pipeline]: One or more component failed validation.

Error at Data Flow Task: There were errors during task validation.

 (Microsoft.DataTransformationServices.VsIntegration)

------------------------------
BUTTONS:

OK
------------------------------
0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 125 total points
ID: 17896346
OK so now its just the Account column.

I think DT_R8 might be a datetime datatype. Somehow Excel has cast this as a datetime.


Is it an option to export the file as a CSV then import the CSV? Excel files have a habit of assigning incorrect data types.

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Author Comment

by:kpu8
ID: 17902085
I'll try that - I didn't even think of that!

Too much going on lately I guess
0
 
LVL 1

Author Comment

by:kpu8
ID: 17904063
I got this working by changing the
account field to be a float when I created the table - also
I had to specify the two other columns directly with nvarchar(4000)
so the table looked like this:

create table acct_data
(
      acct Float,      
      description NVARCHAR(4000),
      short_desc NVARCHAR(4000)
)

0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 17904905
Be careful as float is an 'imprecise' data type.

You will probably find that an account of 100001 appears as 100001 .00000000000000000000000000000000983435 in your database.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now