`
SQL Related Articles: Passing array to a stored procedure 2002-10-01 -- Andy Stapleton Newsgroups: TopSpeed.Products.Drivers Send it as a single string... Arraystring = '1,23,145,33,456' File{Prop:Sql}='Call DBO.MyProc <39>'&ArraySTring&'<39>' call the stored procedure, then inside the stored procedure using Declare @CharCounter integer, @CurrCounter integer, @holdSTring varchar(25) Create #ArrayTable( ArraySTring VArchar(25), ArrayValue integer); SET @CharCounter = 1 While @CurrCounter < LEN(@ArrayString) BEGIN Set @CurrCounter = @currCounter + 1 IF @CurrCounter > Len(@ArrayString) BREAK IF SUBSTRING(@ArraySTring, @CurrCounter,@CurrCounter) = ',' BEGIN SET @HoldString = Substring(@arraystring,@charcounter,@currcounter -1) Insert into #ArrayTable Values( @holdString,Null) SET @charCounter = @CurrCounter + 1 END END Update #ArrayTable Set ArrayValue = StrToValue(ArraySTring) / now you have an table of the elements you sent to the procedure again to work with.... this is off the top of my head , but should get you close.... -- Andy < Printed December 4, 2024, 2:49 am This article has been viewed/printed 35233 times. Google search has resulted in 265 hits on this article since January 25, 2004. |