August 11, 2006 at 2:34 pm
I am receiving a error when running a report. "Syntax error converting the varchar value 'RM' to a column of data type int."
I checked both the datasets that return the data and there both set as Char(2). I know that the colum has both numbers and alph.
Anyone, is there a syntax error that I am missing in the query's? Or knows a work around?
Query 1
="Select distinct jomast.fjobno, jomast.fpartno,jomast.fopen_dt " &
"from jomast " &
"join inmast on jomast.fpartno = inmast.fpartno " &
"Where fjobno not in (Select qalotc.fcdoc from qalotc) " &
"and inmast.fgroup = 'FG' " &
"and jomast.fstatus = 'RELEASED' " &
"and jomast.fpartno <> 'SCRAP' " &
"and jomast.fopen_dt > (getdate() - 30) " &
Iif(Parameters!ProdClass.Value = "O", " ", " and inmast.fprodcl = " & Parameters!ProdClass.value) &
"Order by jomast.fjobno"
Query 2
Declare @var1 char(2)
Select @var1 = 'O'
Select @var1 as fpc_number, 'All Product Codes' as fpc_desc
Union
SELECT [fpc_number]
,[fpc_desc]
FROM [M2MDATA01].[dbo].[inprod]
Order by fpc_desc
August 11, 2006 at 3:28 pm
I would explicitly convert to the data type you require, I have a feeling sql is implicitly converting.
August 14, 2006 at 7:32 am
I had already explicitly set the data type in query 2 "Declare @var1 char(2)
".
Here is want I ended up doing. I created a text box and put the Iif statement in it and found that it would never match the "O" because it was two char so it needed ether trim(Parameters!ProdClass.Value) = "O" or ="O ". So I ended up with a Iif statement like this. Iif(trim(Parameters!ProdClass.Value) = "0" ,"", " and inmast.fprodcl = '" & Parameters!ProdClass.value & "'") &
Hope this will help someone else in the future.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply