I have sql server 2008.
I have two databases: "DB1" and "DB2".
In "DB1" there is a store procedure that has to select values
and insert them to table in "DB2".
I can I do it?
I can I connect to one database from another database?
How can I insert values to table from store procedure in another database SQL server
Started by rivkic, Jul 20 2010 11:00 PM
2 replies to this topic
#1
Posted 20 July 2010 - 11:00 PM
|
|
|
#2
Posted 21 July 2010 - 02:55 AM
just a few questions :
are these two databases on the same Server ? if yes then certainly this is possible.
only thing you need to do is create a stored procedure one more time in Db2 changing the using statement at the Head of sp.
something like this:
From
execute the db like below
Stored procedures are Database specific. This link might also help you
How to run a stored procedure located in one database against another database
are these two databases on the same Server ? if yes then certainly this is possible.
only thing you need to do is create a stored procedure one more time in Db2 changing the using statement at the Head of sp.
something like this:
From
USE DB1 <your sql operations go here>To
USE DB2 <sql operations with Db2>then commit the sql stored procedure to db2.
execute the db like below
EXEC SpName param1,param2
Stored procedures are Database specific. This link might also help you
How to run a stored procedure located in one database against another database
#3
Posted 21 July 2010 - 10:53 PM
Thanks!!!!!!!!!!!!!!!!!!!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









