Type of value error in ssis package

Posted on 2014-01-14
Last Modified: 2016-02-10
I have an ssis execute sql task step

It calls a stored procedure and attempts to dump the output into a user variable of type double.

It is getting a error thrown about not being able to change types mid execution if the result of the stored procedure is zero (I think).

The best way I could troubleshoot this is manually run the stored procedure.  I hard coded the store procedure to act as follows:

declare @array as table(statement float)
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.

	IF @StatementDocNo = 0
			SELECT 0 AS [Amount Due]
			-- Insert statements for procedure here
insert into @array
			SELECT DISTINCT -- select top 10 * from umcr2100
				isnull(util..UMCR2102.umAmount1,0)  AS [Discounted Amount Due]
				INNER JOIN util..UMCR2102 ON util..UMCR2100.umStatementDocNo = util..UMCR2102.umStatementDocNo
				(util..UMCR2100.umStatementDocNo = @StatementDocNo)
				umDescription1 LIKE 'Total Amount Due%'
			SELECT 0 AS [Amount Due]
		 select * from @array

Open in new window

I do not see how it is possible for the code above to throw anything not compatible with a double.  

How can I troubleshoot this/ make this work.

(The output almost always comes out to greater than zero and has a decimal).

This is written in sqlsvr 2008
Question by:UnderSeven
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 65

Accepted Solution

Jim Horn earned 500 total points
ID: 39779790
>SELECT 0 AS [Amount Due]
>SELECT DISTINCT ... AS [Discounted Amount Due]
>SELECT 0 AS [Amount Due]
>select * from @array

For starters, SSIS likes to create a 'contract' between it and a source of data so that it knows what schema to expect, so it can to map columns.  In your case, this means the SQL Task can't handle calling a SP where the return set is not the same schema each and every time.

You'll need to change the above four SELECTs so that it is the same exact schema.
Even better would be to only have one SELECT.

Author Closing Comment

ID: 39779840
That was it, once I normalized the output to all come from the same (explicit type) place it worked.

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server 2012 r2 and SQL 2014 6 34
SQL Server 2012 to SQL Server 2016 24 57
learning MS SSIS 13 23
Query Task 8 22
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question