question

paws27284 avatar image
paws27284 asked

Execute SQL task returning output variables

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
sql-server-2005ssis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.