Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
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 <
Today is November 21, 2024, 3:30 am This article has been viewed 35216 times. Google search has resulted in 265 hits on this article since January 25, 2004.
|
|