I eine gespeicherte Prozedur schreiben, wieFehler bei der Konvertierung, wenn die VARCHAR-Wert-Umwandlungs ‚select FNo aus Apts wo Namen wie‚% Jagd%‘‘ in dem Datentyp int
IF @Action=101
BEGIN
select a.name as Name,
m.sccity as sccity,
ISNULL(c.coursetype,' ')+': '+ISNULL(c.coursename,'')+', CODE:'+Convert(varchar(4),c.course) as 'Course Details',
replace(convert(varchar(20),a.dob,106),' ','-') as dob,
a.gender as gender,
a.medium as medium,
a.cat as cat,
a.oldfno as oldfno,
a.bgroup as bgroup,
a.add1 as add1,
a.add2 as add2,
a.add3 as add3,
a.city as city,
a.district as district,
a.state as state,
a.pin as pin,
a.std as std,
a.phone1 as phone1,
a.phone2 as phone2,
a.mobile1 as mobile1,
a.mobile2 as mobile2,
a.pcourse as pcourse
from apts a, courses c ,mastsc m
where c.course=a.course
and a.studyccode=m.studyccode
and a.isdeleted=0 and c.isdeleted=0
and m.isdeleted=0 and c.course>0
and a.fno in (@subquery)
END
folgt, ist es zwei variable @Action Typ integer und @subquery type varchar @subquery wird in IN() -Klausel übergeben. Aber wenn ich dies ausführe und eine Unterabfrage übergebe, bekomme ich einen Fehler. Bitte geben Sie eine Lösung Danke im Voraus
a.fno in (cast (@subquery als int)) END – TharunRaja