Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Executing query as variable, no parameters?

$
0
0

I  currently have an SSIS Package that conatins an execute SQL Task that starts at the begining of the package. I am using this to put the date and time for the first and alst day of each month into an Access table that is used later in the package.

I have the SQL SourceType set up as a Variable the Source Variable is User:SQL

The expression for the User:SQL is:

"UPDATE    tbl_startEndDates

 SET  startDate ='" +   @[User::StringStartDate] + "'," +
" endDate ='" + @[User::StringEndDate] + "'," +
" weekOrMonth = M"

Where the following strings are below

 StringStartDate= ((DT_WSTR, 111)  @[User::DateStart]) ,StringEndDate= ((DT_WSTR, 111)  @[User::DateEnd])

AND

@[User::DateStart]) = (DT_DATE)(DT_DBDATE)DATEADD("dd",-1 * (DAY(GETDATE())-1),DATEADD("month",-1,GETDATE()))
@[User::DateEnd])= DATEADD("mi",-1,(DT_DATE)(DT_DBDATE) DATEADD("dd",0,DATEADD("dd",-1 * (DAY(GETDATE())-1),DATEADD("month",-0,GETDATE()))))

I know I probably overcomplicated this aspect but I was unsure of how to convert them into the correct format for Access.

The Query Builder looks like this:


When I try to Run the query from the Query Builder I recieve the folowwing error:

 

And when I try to execute just the SQL task I recieve the error below, Any suggestions?

And when I try to execute just the SQL task I recieve the error below 

Warning: 0x0 at Execute SQL Task: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

Warning: 0x0 at Execute SQL Task: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE tbl_startEndDates

SET startDate ='8/..." failed with the following error: "No value given for one or more required parameters.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Task failed: Execute SQL Task

SSIS package "Month.dtsx" finished: Success.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>