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

SQL Query built from TASK OUTPUT parameter failing if more than 4000 characters, want to use up to 8000 characters

$
0
0

I have googled this, but have not hit upon the correct combination of phrases to find my answer. I support an SSIS ETL package but I am not an SSIS guru. 

My issue is that the SSIS package fails if the SELECT statement, that is in an SSIS variable, is over 4k characters. I assume that this is an NVARCHAR limit. Would like to change the variable to VARCHAR to get an 8k limit. Or ideally to be varchar(max). But I cannot find where to make this change.  

TASK1 that calls SQL sproc BuildQuery. BuildQuery builds a SELECT statement that is passed back to SSIS as a OUTPUT Parameter with VARCHAR(8000).  In SSIS this OUTPUT Parameter is assigned to User::SQLSource variable. The original declaration of SQLSource variable says STRING - with no length. The SSIS Parameter Mapping of the OUTPUT parameter to SQLSource variable has the DATA TYPE = VARCHAR and Parameter Size = -1. 

Directly after TASK1 is Data Flow Component DataFlow1. DataFlow1 uses the SQLSource variable, which contains a SELECT statement, to extract data from a DB2 table. DataFlow1 is defined with ACCESSMODE=SQL Command From Variable,  SQLCommandVariable=User::SQLSource.

So how can i get an query with greater than 4000 characters in the SQLSource variable? Right now, the sproc BuildQuery is building a SELECT statement that is 4010k in length and the SSIS package is failing with an ill-formed query. If I remove some of the columns from the SELECT statement to make the SELECT under 4k the SSIS package runs successfully.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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