Ah... I see what the problem is. What you'll then want to do inside of the
SP is to declare a new variable varchar(5000) to hold sql code. Then you can
write the query code to the variable string and append the attributes passed
in from the SP call.
EXAMPLE:
CREATE PROCEDURE dbo.SP_DynamicSP @IDList varchar(1000)
AS
DECLARE @DynSQL varchar(5000)
SET @DynSQl = 'SELECT * '+
'FROM MyTable ' +
'WHERE MyID IN (' + @IDList + ') ' +
'ORDER BY MyID'
EXEC(@DynSQL)
GO
However, you may find that you lose the speed benefits presented by SP's as
there is really very little code to precompile here. At least that's my
understanding of how SP's provide the speed boost.
-Nate
-----Original Message-----
From: Costas Piliotis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 6:00 PM
To: CF-Talk
Subject: RE: Stored Procedure
See though, it's not that simple for this problem.
They're trying to parse a comma delimited list...
They should use dynamic sql to do what they're trying to accomplish.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists