?
Solved

SQL Server 2005 - SSIS using Excel to a Table

Posted on 2006-11-06
6
Medium Priority
?
4,466 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 500 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

762 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