Solved

SSIS DATA FLOW TASK - USING FIELD IN EXISTING TABLE

Posted on 2013-02-03
9
320 Views
Last Modified: 2016-02-10
I have a package set up that successfully imports a csv file into a table in MS SQL 2008 database.  It imports data into all columns in that table except for 1.  In that last column, I wish to fill it in with whatever date rests in a field in another table.  The other table has only 1 record, so I thought somewhere I could say "select fieldname from tablename" and use the result for that last column.

Not sure what the best way to do this would be.
0
Comment
Question by:mak345
9 Comments
 
LVL 4

Expert Comment

by:rshq
ID: 38849296
Hi
 
  You can using UPDATE command after Import for change last field.
0
 

Author Comment

by:mak345
ID: 38849309
Isn't there a way to build a variable that selects whatever value I have in the other table and use it in the column mapping in my data flow?
0
 
LVL 10

Expert Comment

by:deviprasadg
ID: 38849984
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 6

Expert Comment

by:liija
ID: 38850146
Sure, map first the result set to your variable:
http://msdn.microsoft.com/en-us/library/ms141689.aspx

Then with 'Derived Column' you can add your variable as a new column inside the data flow.
0
 

Author Comment

by:mak345
ID: 38852071
I seem to be on the right track using liija's link above, but am getting an error in the Execute SQL Task:

An error occurred while assigning a value to variable "xyz".  The type of the value being assigned to variable "xyz" differes from the current variable type.  

The value I am trying to put in the variable is of "date" datatype.  The variable only lets me choose datetime.  

How do I fix?

Thanks
0
 
LVL 6

Accepted Solution

by:
liija earned 50 total points
ID: 38852191
You could cast your date column to datetime inside your SQL - since there is no 'Date' data type in SSIS.

SELECT CAST(YourDateColumn AS DATETIME) AS YourDateColumn FROM YourTable
0
 

Author Comment

by:mak345
ID: 38852228
Thanks, but I seem to be getting a different error now.  It is still occurring in the Execute SQL Task:

"Unable to find 'mydatecolumn' in the result set".
0
 

Author Comment

by:mak345
ID: 38852237
Sorry, the above actually worked.  I neglected to put the " AS yourdatecolumn" at the end.

THANK YOU!
0
 
LVL 6

Expert Comment

by:liija
ID: 38852261
You're welcome
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tempdb log contention 16 38
SQL Server merge records in one table 2 21
replicated - directional or bidirectional? 3 29
sql how to count case when 4 14
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 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