Solved

SSIS: Using variable in OLE DB SQL command text

Posted on 2011-02-15
3
1,039 Views
Last Modified: 2013-11-10
Is there a way to reference a variable as part of the SQL command text in the OLE DB source editor?

For example if I have a variable defined as myVar::
SELECT myVar, Account, CustName from Customers

resulting in output of:
RESIDENTIAL, 100, Steve
RESIDENTIAL, 200, Jim
etc.

0
Comment
Question by:wppiexperts
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
EvilPostIt earned 125 total points
ID: 34897743
In the data access mode drop down box you can choose the "SQL Command from variable" and then choose the variable you want to use.
0
 

Author Comment

by:wppiexperts
ID: 34897781
so the only way to incorporate a variable like that is to build a variable containing the SQL string, there is now way to reference it via @User:: or anything like that?
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34897799
Yes you reference it using the source component after selecting the "SQL Command from variable" drop down.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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 combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now