Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SQL Error in Qlik Only

I have a part of my load script that calls a stored procedure:

Hours:

SQL

EXECUTE Finance_Budgeting_2.dbo.spNewFY17Rollup 2, NULL, NULL;

Store Hours INTO Hours.qvd

;

When I reload the script, I get the following error:

SQL##f - SqlState: 22005, ErrorCode: 245, ErrorMsg: [Microsoft][ODBC SQL Server Driver][SQL Server]Conversion failed when converting the nvarchar value 'Org Level 1 Code' to data type int.

Hours:

SQL

EXECUTE Finance_Budgeting_2.dbo.spNewFY17Rollup 2, NULL, NULL

However, when I execute the stored procedure outside of Qlik, I get no error at all. Has anyone else ran into this issue?

7 Replies
Clever_Anjos
Employee
Employee

Do you have that procedure signature? Please post here

Anonymous
Not applicable
Author

Sorry, what do you mean by procedure signature?

Clever_Anjos
Employee
Employee

for example

Create Procedure spNewFY17Rollup (

     @param1 varchar,

     @param2 int

)

Anonymous
Not applicable
Author

CREATE PROCEDURE [dbo].[spNewFY17Rollup]

  @Type int = 0,

  @Area varchar(50) = NULL,

  @SubRegion varchar(50) = NULL

If @Type = 2 --Salary - Base, OT, On Call Hour against current employees

BEGIN

  Select Distinct sh.*, CASE WHEN sh.Base = 0 AND sh.OnCall = 0 AND sh.Overtime = 0 THEN 'No Hours Entered' ELSE 'Hours Entered' END AS [Review Status]

  From vwNewFY17SalaryHoursCurrentPicture sh Inner Join

  vwDistributionList dl ON /*sh.BusUnit = dl.BusUnit AND */ sh.CostCenter = dl.CostCenter

  Where ((@Area IS NULL OR @Area = dl.SDrive_Area )

  AND (@SubRegion IS NULL OR @SubRegion = dl.SDrive_Region))

END

This is the detail in the stored procedure.

Clever_Anjos
Employee
Employee

Is it possible to run this and post here?

  1. Select Distinct sh.*, CASE WHEN sh.Base = 0 AND sh.OnCall = 0 AND sh.Overtime = 0 THEN 'No Hours Entered' ELSE 'Hours Entered' END AS [Review Status] 
  2.   From vwNewFY17SalaryHoursCurrentPicture sh Inner Join 
  3.   vwDistributionList dl ON sh.CostCenter = dl.CostCenter 
Anonymous
Not applicable
Author

I got it to work by pasting the code from the stored proc. No idea why, but it now works. Thanks.

Clever_Anjos
Employee
Employee

You´re welcome