Use Variable in SQL Command SSIS of ADO net source
Yes, you can do it, using expression.
Open data flow task, right-click on empty space there and choose "Properties".
In "Properties" window choose "Expressions"
In opened window choose [Your data source].[SqlCommand] and add you variable there in Expression input.
SSIS - Passing Parameters to an ADO .NET Source query
From your description it seems like you are having an error due to using the variable name inside the query string as opposed to the processed variable value. In other words:
"SELECT * FROM @[User::TABLE]"
in the expression builder would be WRONG
"SELECT * FROM " + @[User::TABLE]
would be CORRECT
It would help if you shared the expression you are using as a query
SSIS Query Parameters for ADO .NET Source
Set Data Access Mode in ADO.NET Source to SQL Command
and write the query.
Using Dynamic Table name in ADO.NET Source Editor
Expression must be set on the Data Flow Task
not in the Ado.net Source
Follow this steps to set an expression for an Ado.net Source
:
- in the
control flow
tab click on theData Flow Task
and pressF4
to show the properties tab - Click on the expression button, it show up a form like shown below
- choose
[Ado.net Source].sqlcommand
property and click on the expression builder button
- write the following expression
"select * from Sample_ " + @[User::DateParameter] + "_Data"
(assuming that your data parameter is stored in a variable namedDateParameter
)
Related Topics
Postgresql With-Delete "Relation Does Not Exists"
Oracle: How to Implement a "Natural" Order-By in a SQL Query
Difference Between Varchar(500) VS Varchar(Max) in SQL Server
How to Specify in Clause in a Dynamic Query Using a Variable
List of Stored Procedure from Table
SQL Server Regular Expressions
What Does "&" Means in This SQL Where Clause
Using Oracle SQL, How Does One Output Day Number of Week and Day of Week
Finding the Count of Characters and Numbers in a String
Casting Scientific Notation (From Varchar -> Numeric) in a View
SQL Server 2005 Recursive Query with Loops in Data - Is It Possible
How to Calculate a Moving Average Using MySQL