Insert Data into Variable in Sql task ado.net
I Declare new variable name LastDate type date time I want to use Sql task and insert data to the variable Select Max(Date) from MyDateTable my connection is Ado net 2008 r2 i'm very confused with the declaration of input/output parameter and resault set etc.. can you please tell me step by step how do i do it?
October 29th, 2010 10:04am

You don't need an input/output varialbe/parameter mapping. If you are using an Execut SQL Task, set the ResultSet property on the main page to "Single Row". Then go to the Resuts page, and ADD a result, named "0" and specify the User::LastDate variable .Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
October 29th, 2010 10:31am

Thanks alot it really was that simple. Now i would like to use the Variable in other components for example i have ADO data source, and i would like select * from mytate where mydate < = @LastDate Last date is the variable i declare before, but somewhy the @LastDate can't be used so simple , how do i use the declared variables on ADO connections ?
October 30th, 2010 1:48pm

Almost as simple. Create a Source adapter on the data flow and set the Data Access mode to SQL Command. put in your query as SELECT ... FROM ... WHERE [SomeDate] >= ? then in the Parameter mapping page, map a singe variable named "0" to the variable. Set the data type appropriately.Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
October 30th, 2010 5:05pm

Can you please elaborate on the steps to take regarding 1) create a source adapter and 2) setting the Data Access mode to SQL command? I need to access an Oracle 8i database using SSIS. I've set up my variables but when i write the SQL (as a Sql command expression ) with the variable parameter, I can't see where my ADO source recognizes the DFT SQl command property. Can you provide step-by-step guideleines on getting the DFT Sql command expression to show up as the Sql Command for the ADO source in the DFT? thanks Maggie de Leon
January 22nd, 2011 8:43pm

Can you please elaborate on the steps to take regarding 1) create a source adapter and 2) setting the Data Access mode to SQL command? I need to access an Oracle 8i database using SSIS. I've set up my variables but when i write the SQL (as a Sql command expression ) with the variable parameter, I can't see where my ADO source recognizes the DFT SQl command property. Can you provide step-by-step guideleines on getting the DFT Sql command expression to show up as the Sql Command for the ADO source in the DFT? thanks Maggie de Leon
Free Windows Admin Tool Kit Click here and download it now
January 22nd, 2011 8:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics