[thelist] SP Problem

listman at hazard0us.org listman at hazard0us.org
Tue Oct 8 10:12:01 CDT 2002


In :

>SELECT schSCID
>FROM SupportCallHistory
>WHERE schStatus = 2
>AND cast(schBID as varchar) IN ( ' + @iToBuild + ',' + @sLaterBuild + ')
>)
>ORDER BY scID'

This line appears to be wrong :

>AND cast(schBID as varchar) IN ( ' + @iToBuild + ',' + @sLaterBuild + ')

what you have missed is putting the single quotes within the IN() clause
so instead of getting passed as :

>WHERE cast(sciBuildNo as varchar) IN
>('236','10','100','101','102','103','104',.....

it is getting passed as :

>WHERE cast(sciBuildNo as varchar) IN
>(236,10,100,101,102,103,104,.....

so it gives in error as an attempt is made to match a  buildno char to the
integer contents of IN()-

You can do either of the following to correct matters:

cast sciBuildNo as an  integer,  instead of varchar (or) pad @iToBuild &
@sLaterBuild with single quotes....


HTH
ashok

------
Ashok Hariharan
http://www.unganisha.org
------









More information about the thelist mailing list