` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please 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!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

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 <> Stapleton CIO DB|Wired.com / (ccs) Cowboy Computing Solutions www.dbwired.com Web and Clarionet hosting www.ccscowboy.com CCS SQL templates www.Paywire.com ACH / Credit Card payment processing "Cliff Campbell & Associates" wrote in message news:3d996ae6@news.softvelocity.com... > Hi, > > I have a problem. I need to be able to pass in a list/array/table or > anything else of integer items into an MS SQL Stored Proc for processing. > However, I cannot find a data type in Transact-SQL to help me do this and I > do not want to have to put the CALL to the proc. into a loop. > I fear it is not possible but I hope someone can help me out with an idea. > > Cheers, > > Iain > >


Today is April 28, 2024, 5:27 am
This article has been viewed 35111 times.
Google search has resulted in 265 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: