Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 calling a sp with parameters from another sp

Author  Topic 

delbar
Starting Member

5 Posts

Posted - 2009-11-17 : 04:40:45
urgent. How do I all a stored procedure that has a parameter and returns a result set of records from another stored procedure? In this other stored proc I will need to call the parameter in also.

thanks,
delbar

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-17 : 09:04:46
[code]
Create Proc yourProc
AS

Declare @param int
set @param = 5
Exec someOtherProc @param[/code]

or
[code]
Create Proc yourProc
@param int
AS

Exec someOtherProc @param[/code]
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-11-17 : 10:59:03
[code]
DECLARE @Return varchar(2000)
EXEC [dbo].[my_sp] @one,@Return output
SELECT @Return

[/code]
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-11-17 : 11:08:05
NB: dont forget to use the keyword output after the return value
Go to Top of Page

delbar
Starting Member

5 Posts

Posted - 2009-11-17 : 11:58:09
thank you all for your contributions - will certainly use them all.... What I have doneout was to create a table variable and a parameter in my sproc.
e.g.;
Create spGetSPRowset
@DateVal as varchar (6)

as

Declare @people table
(NewPK int identity(1,1),
Namechar(3) null,
PrimNumber char(6) null,
PrimClass char (1) null
)

insert into @people
exec dbo.uspGetRows @Rows = @DateVal

now I have to do something else with the data - like a few select statements to filter the data.
thanks again all for your quick replies!!!!
Go to Top of Page
   

- Advertisement -