Solved

SQL Server 2005 - SSIS using Excel to a Table

Posted on 2006-11-06
6
4,455 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Slow Connectivity over ODBC 8 36
Run SQL Server Proc from Access 11 31
create an aggregate function 9 34
Need help constructing a conditional update query 16 46
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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

777 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