SSIS – Deployment Failed When Working with Files

csvdeploymentsql serverssis

I've developed a simple SSIS package that will open a csv file, select a number of column, add two derived columns and then copy the results to a file.

This works within visual studio (even if it takes ages) where I constructed it. The problem is when I attempt to deploy it to our sql server it fails.

It keeps say that:

"The specified parameter value string is too long. The string must be no more than 8000 characters." 

But I have no idea what it is talking about as none of my columns is over 1000 characters.

There isn't much info on this error but is it possible that the number of rows (400,000+) is the source of the problem?

Best Answer

This isn't a problem with your data - it is a problem with your package. Usually, this is a problem with the size of your query.

It appears that internally, SSIS uses a varchar(8000) value somewhere that could actually use a varchar(max) value. When you run up against this limit, you get this ambiguous error.

There are several ways you can approach this. You can shorten your query (by removing excessive whitespace, replacing spaces with tabs, compacting indents, etc).

You can also split your query out into multiple variables or parameters, then concatenate the pieces back together with an expression task before executing the query.

Depending on the query, you could also convert it into one or more stored procedures or views, and call those within your package.

But if you keep the query inside the package, you need to reduce its length (or its piece's lengths) to less than 8000 characters. Have fun.

Have fun - nothing is more fun than refactoring a query.