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

SSIS Command from Variable Fails with Certain SQL

$
0
0

I have an SSIS package running against SQL Server 2008.  Each of the tasks in this package use a SQL command from variable to which I pass in the entire sql string for that task (no additional variables are plugged into the sql I pass).  Each of these tasks inserts rows into one Access database table (one to one correspondence between tasks and tables).

Here's the deal:  In certain circumstances the sql passed to one of the tasks is failing.  These are the errors I get on failure:

Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E14  Description: "Statement(s) could not be prepared.".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E14  Description: "Incorrect syntax near '('.".  Source: Copy  LOCATION SSIS.Pipeline Description: "component"OLE DB Source" (1)" failed validation and returned validation status "VS_ISBROKEN".

Here is the sql being passed to the task:

SELECT * FROM LOCATION A WHERE A.AGENCY_ID = '44' AND A.IS_ARCHIVE = 0 AND EXISTS (
SELECT MASTER_LOCAL_ID
FROM TCDS.dbo.LOCATION
WHERE AGENCY_ID = A.AGENCY_ID
AND MASTER_LOCAL_ID = A.MASTER_LOCAL_ID
AND ( LOCAL_ID LIKE '009040')) AND A.community LIKE '%%' AND A.STATE LIKE 'IL'

If I paste this sql directly into the task as a SQL command, instead of passing it in, it works fine and the entire SSIS package runs and fills my Access database as expected.

The incorrect syntax issuein the error messages above leads me to believe it doesn't like this nested sql, but it works fine if i paste the exact same sql in the task itself.  When other sql is passed to this task as a variable it works fine.

Any ideas?

Thank you.

Laura Creagh


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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