• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

SSIS DATA FLOW TASK - USING FIELD IN EXISTING TABLE

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
mak345
Asked:
mak345
1 Solution
 
rshqCommented:
Hi
 
  You can using UPDATE command after Import for change last field.
0
 
mak345Author Commented:
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
 
deviprasadgCommented:
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
liijaCommented:
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
 
mak345Author Commented:
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
 
liijaCommented:
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
 
mak345Author Commented:
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
 
mak345Author Commented:
Sorry, the above actually worked.  I neglected to put the " AS yourdatecolumn" at the end.

THANK YOU!
0
 
liijaCommented:
You're welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now