Solved

SQL Server 2005 - SSIS using Excel to a Table

Posted on 2006-11-06
6
4,464 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

696 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