|  | Posted by --CELKO-- on 09/29/07 00:52 
>> In my stored procedure, I want to parse @ArrayOfDays into @d1 through @d5 ..  execute a dynamically built SELECT. <<
 You are doing almost everything wrong.  SQL does not work this way.
 Just pass a simple five parameter list. Then clean up your data in the
 procedure body.  Try this for a skeleton
 
 CREATE PROCEDURE Foobar
 (@d1 INTEGER, @d2 INTEGER, @d3 INTEGER, @d4 INTEGER, @d5 INTEGER)
 AS
 SELECT ..
 FROM Floob
 WHERE Floob.x IN (@d1, @d2, @d3, @d4, @d5)
 AND ..;
 
 YOU can use COALESCE in the IN() list to handle NULLs or whatever.
  Navigation: [Reply to this message] |