Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL Server 2005 - SSIS using Excel to a Table

Posted on 2006-11-06
6
Medium Priority
?
4,470 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

618 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