Try building the sql up into a string variable and then execute the string
using exec (sqlstring)

-----Original Message-----
From: Craig Dudley [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 10:05
To: SQL
Subject: IN clause in a SQL 7 stored Proc


Morning all,

I'm getting undesirable results with a stored proc, the suspect part of
which is very much like the following;



Update tblBlah
Set Field1 = 1  
where someID = @someID and someID in ( select sometherID from tblBlah2 where
anotherID = @anotherID);



The problem is, the subquery that is inside the in clause is returning a 5
character varchar field which happens to contain all digits, like so: 

14278,95478,01247,01457

These values are ALL stored as varchars whereever they are used, nowhere in
the database are they numeric.

SQL seems to be treating these as ints and chopping any zero's of the front,
hence any records which have a coresponding value whcih begins with a zero
are not being updated.

Is there any way I can program the stored proc so it knows that the subquery
will be returning varchar values ?

Thanks for any help.


______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to