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 2005 Forums
 Transact-SQL (2005)
 Very Urgent and Complex matter !!!!

Author  Topic 

aravindt77
Posting Yak Master

120 Posts

Posted - 2007-12-12 : 00:02:09
Hi,

This is very urgent and a complex matter as far as I m concernded..
so I thank in advance for those whose made effort in attempting the problem...

The scenario is that
There are several database .. ie a MAsterDB and no of DetailsDB

I want to execute a SP in DetailsDB from MasterDB and should get the OUTPUT
parameter value in MasterDB ie


SP in DetailsDB
----------------

Create proc detailssp(@inp int , @dop int OUTPUT)
AS
BEGIN
IF @inp < 5
set @dop = @inp * 2
else
set @dop - @inp * 10

return
END

SP in MasterDB
--------------

Create proc Mastersp (@dbname nvARCHAR(50) , @minp int , @mop int OUTPUT)
AS
BEGIN

---- (@dbname is the name of DetailsDB)

HERE I need a statement to call the SP in Corresponding database
Database name is in the paramerter @dbname

Also need the output variable value from that SP in @mop variable


END



Thanks & Regards

Aravind

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-12-12 : 00:10:24
only way to do this is with dynamic sql. this seems like a poor design to me.


elsasoft.org
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-12 : 01:03:16
www.sommarskog.se/dynamic_sql.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -