SolvedPrivate

Changing the Value of a variable on the fly in SSIS

Posted on 2014-09-12
10
30 Views
Last Modified: 2016-02-11
Good morning,

I have three loops that i need to run to get files from folders. I have one variable called @table_name that i want to use to update the table, (thru a sp). and input the file name that i just looped thru in the table. The table name will change for each file type.  so, i'll use dynamic sql in the sp, and pass in the variable name (table). Initially this works fine, but i can't figure out the best way to update the variable. Would it be better to do this with a derrived column ? though, i though that would work, i keep getting an error (something about conversion).
0
Comment
Question by:basile
  • 4
  • 3
10 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 40319181
>can't figure out the best way to update the variable.
Note quite following you, but to update a variable 'on the fly' in SSIS create a script task, pass the variable that has the value as read only, pass the variable name to be updated as read-write, and using VB code the script will go like this:

Dts.Variable("variable_name_to_write_to").Value = Dts.Variable("variable_name_to_write_from").Value
0
 
LVL 1

Author Comment

by:basile
ID: 40332433
I've requested that this question be deleted for the following reason:

I couldn't get an answer for this question.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40332434
Uhh, no.  Please work with experts when they make comments.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 1

Author Comment

by:basile
ID: 40332816
I don't understand? I didn't get the answer I was looking for... Should I give the credit anyway?
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40332927
>I didn't get the answer I was looking for...
And you didn't respond to expert comments either.  So, please spell out how we would know 'what you are looking for' if there is no follow-up between asker and expert.  Vulcan mind meld?  The Force?   Most experts are not going to write a book based on a five line question with no follow-ups.

I'm not intentionally trying to be rude here, but askers have an obligation to work with the experts that are trying to help.
0
 
LVL 1

Author Comment

by:basile
ID: 40333210
ok, not taking anythign as being  rude. it was my fault. I was able to figure out a solution. I could care less about the points, so i can award them. i apologize for not following protocol, i've been on here a long time, and i've never had an issue.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40333238
np
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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