Showing posts with label parametr. Show all posts
Showing posts with label parametr. Show all posts

Friday, March 9, 2012

Possible to pass table as parametr to stored procedure??

In one stored procedure i create temporary table and fill it with data,
after this i call to other stored procedure to which i want pass table as
parameter.
How can i do it '
Message posted via http://www.webservertalk.comNo there is not way without looping through a resultset and giving the
seperate fields as variables or as an "array".
http://vyaskn.tripod.com/passing_ar..._procedures.htm
But you could create a (gobal) temp table from another procedure and call
this temp table at the destination procedure.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"JB via webservertalk.com" <forum@.nospam.webservertalk.com> schrieb im Newsbeitrag
news:c902681f62414d1cb7c0a8dca5cea43e@.SQ
webservertalk.com...
> In one stored procedure i create temporary table and fill it with data,
> after this i call to other stored procedure to which i want pass table as
> parameter.
> How can i do it '
> --
> Message posted via http://www.webservertalk.com|||See if this helps: http://www.sommarskog.se/share_data.html
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"JB via webservertalk.com" <forum@.nospam.webservertalk.com> wrote in message
news:c902681f62414d1cb7c0a8dca5cea43e@.SQ
webservertalk.com...
> In one stored procedure i create temporary table and fill it with data,
> after this i call to other stored procedure to which i want pass table as
> parameter.
> How can i do it '
> --
> Message posted via http://www.webservertalk.com|||Hi
Or you can create a Table using the Table Data Type and pass that between
SP's.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:OJND4SbTFHA.2128@.TK2MSFTNGP15.phx.gbl...
> No there is not way without looping through a resultset and giving the
> seperate fields as variables or as an "array".
> http://vyaskn.tripod.com/passing_ar..._procedures.htm
>
> But you could create a (gobal) temp table from another procedure and call
> this temp table at the destination procedure.
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "JB via webservertalk.com" <forum@.nospam.webservertalk.com> schrieb im
> Newsbeitrag news:c902681f62414d1cb7c0a8dca5cea43e@.SQ
webservertalk.com...
>|||Thanks for replay.
In my sp i define:
DECLARE @.myTable TABLE(
[col1] [int] ,
[col2] [bit] ,
..........
..........
if i understand i can do the same and to declare as @.@.myTable
and from now i can use this tabel in all proc?
Message posted via http://www.webservertalk.com|||thanks however it not help me. (i've read it before).
Message posted via http://www.webservertalk.com|||can u give a sample? i don't really undersatand how to achieve it
Message posted via http://www.webservertalk.com|||You cannot pass a table variable as parameter to stored procedures. But if
you look at the article I posted in my previous post, you will find a way
out
--
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"JB via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:053b03bed2fe474fb8510840a324d760@.SQ
webservertalk.com...
> can u give a sample? i don't really undersatand how to achieve it
> --
> Message posted via http://www.webservertalk.com|||O yes.. u r right my mistake, sorry
Thank u very much.
Message posted via http://www.webservertalk.com|||Hi
See if it helps you
Use Northwind
CREATE PROC mysp2
AS
SELECT * FROM #Test
GO
CREATE PROC mysp1--Main stored procedure
@.Ord INT
AS
CREATE TABLE #Test
(
cust CHAR(5)
)
INSERT INTO #Test SELECT Customerid FROM Orders WHERE OrderId=@.Ord
EXEC mysp2 --We will use the #Test temp table within mysp2
--Usage
EXEC mysp1 10248
DROP PROC mysp1,mysp2
"JB via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:fcd2f7925c90404592916ac6c168bcc5@.SQ
webservertalk.com...
> thanks however it not help me. (i've read it before).
> --
> Message posted via http://www.webservertalk.com