February 20, 2010 at 3:57 pm
Helo,
I have 2 questions about SP:
1- How can I make the SP's parameter receive an array value to work on each value in it ?
2- How can I call a SP1 from SP2 ?
I googled for the answers but I couldn't understand the code, So I hope you can make it more simple.
Thanks
February 20, 2010 at 4:37 pm
Mando_eg (2/20/2010)
Helo,I have 2 questions about SP:
1- How can I make the SP's parameter receive an array value to work on each value in it ?
2- How can I call a SP1 from SP2 ?
I googled for the answers but I couldn't understand the code, So I hope you can make it more simple.
Thanks
Regarding question 1:
I, personally, would convert the array into an xml structure and use that as input parameter. Starting with SQL Server 2008 you could also use a table structure but I haven't used it yet.
Question 2:
within your SP2:
EXEC SP1 (for details, please see BOL (BooksOnLine, the SQL Server help system usually installed together with SQL Server), section "EXECUTE statement".
February 20, 2010 at 5:27 pm
Thanks lmu92 for your reply
You put me on the start point, I will keep searching...
I hope if you have some examples to put the links to see it because I'm trying to learn SQL Server by my self
Regards
February 21, 2010 at 11:22 am
Mando_eg (2/20/2010)
Thanks lmu92 for your replyYou put me on the start point, I will keep searching...
I hope if you have some examples to put the links to see it because I'm trying to learn SQL Server by my self
Regards
If you dont want xml in Sql2008 you can pass in a @table so that you have a well defined object model. if you are scared of using XML.
i personally would go with XML.
Regards
Vinay
February 21, 2010 at 1:44 pm
Mando_eg (2/20/2010)
Thanks lmu92 for your replyYou put me on the start point, I will keep searching...
I hope if you have some examples to put the links to see it because I'm trying to learn SQL Server by my self
Regards
How about the other way around?
You wrote that you found some code you didn't understand completely. How about posting this code and mark the sections where you got stuck? (assuming we don't talk about hundreds of lines of code, of course... 😉 )
February 21, 2010 at 7:16 pm
I personally don't like the extra overhead the XML puts on the "pipe" or the SQL Server during XML shredding. Also, since this is an SQL Server 2005 forum, passing a Table Variable isn't much of an option. Besides, large Table Variables are a little tough on execution plans because they are assumed to only have 1 row and the don't use statistics.
As a side bar, parsing VARCHAR(8000) delimited strings with a Tally or Numbers table rivals CLR speeds.
For a bit more information on the subject of passing "arrays" of data in SQL Server, please see the following article...
http://www.sqlservercentral.com/articles/T-SQL/63003/
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply