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
 Transact-SQL (2000)
 urgent help

Author  Topic 

shubhada
Posting Yak Master

117 Posts

Posted - 2005-11-07 : 01:48:17
I have two database Database A and database B.
I want to call one procedure of Database A into database B.


shubhada

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-07 : 02:07:51
Try this

EXEC DatabaseB..yourSp 'paramm1','param2' -- if any

Madhivanan

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

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-11-07 : 02:08:25
Exec DatabaseA..ProcName <Parameter>

Hope this helps.

Complicated things can be done by simple thinking
Go to Top of Page

shubhada
Posting Yak Master

117 Posts

Posted - 2005-11-07 : 02:25:05
is it possible for me to create a link between two database?

shubhada
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-11-07 : 02:30:06
what kind of link?

you can create the sproc in one database, which contains statements querying in the tables of the other database



--------------------
keeping it simple...
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-11-07 : 02:31:45
what kind of link???.. .. are the 2 database on the same server.. ???

then there is no need to create the link between them ..
but if they are on different servers then you have to create the link between them .. by using this sp..
sp_addlinkedserver

try searching on Book online for more details about this stored procedure..


Complicated things can be done by simple thinking
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-07 : 03:35:32
If they are on the same database you can simply use DBName..ObjectName

Madhivanan

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

shubhada
Posting Yak Master

117 Posts

Posted - 2005-11-07 : 04:41:35
thanks a lot

shubhada
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-07 : 05:42:16
You can know more information on Linked server in the Books On Line, SQL Server help file

Madhivanan

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

- Advertisement -