I am trying to use the Execute Sql Task to retrieve specific date values from the database that are assigned to package variables. Here is what I have set in the General Setting tab:
![alt text][1]
The SQL statement is
Select
Left(Convert(Varchar,(DateAdd(mm,-1,GetDate())),112),6) + '16' as ?,
Left(Convert(Varchar,GetDate(),112),6) + '15' as ?
The User::BegDate and Use::EndDate are defined as strings. Here is the parameters tab:
![alt text][2]
I receive the error "Incorrect syntax near '@P1'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly."
When I execute the statement like this in SQL Query window it returns the values I expect
Select
Left(Convert(Varchar,(DateAdd(mm,-1,GetDate())),112),6) + '16' as BegDate,
Left(Convert(Varchar,GetDate(),112),6) + '15' as EndDate
I find lots of help regarding input variables, but not output variables. Can you help?
Thanks!
paws27284
[1]: /storage/temp/379-\executesqltask+general+setting.jpg
[2]: /storage/temp/380-\executesqltask+general.jpg
↧