Solved

SSIS: Using variable in OLE DB SQL command text

Posted on 2011-02-15
3
1,043 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how the fundamental information of how to create a table.

713 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