Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
jhillock
New Contributor II

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
Employee
Employee

Re: SQL Error in Qlik Only

Do you have that procedure signature? Please post here

jhillock
New Contributor II

Re: SQL Error in Qlik Only

Sorry, what do you mean by procedure signature?

Employee
Employee

Re: SQL Error in Qlik Only

for example

Create Procedure spNewFY17Rollup (

     @param1 varchar,

     @param2 int

)

jhillock
New Contributor II

Re: SQL Error in Qlik Only

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.

Employee
Employee

Re: SQL Error in Qlik Only

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 
jhillock
New Contributor II

Re: SQL Error in Qlik Only

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

Employee
Employee

Re: SQL Error in Qlik Only

You´re welcome

Community Browser