Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
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 December 3, 2024, 11:18 am This article has been viewed 35233 times. Google search has resulted in 265 hits on this article since January 25, 2004.
|
|