connecting to a database from a stored procedure
Database
2
Posts
2
Posters
0
Views
1
Watching
-
hi i want to connect to a sql database from a stored procedure of another sql database and insert data into a table. shelly
-
hi i want to connect to a sql database from a stored procedure of another sql database and insert data into a table. shelly
Since you don't mention which database you are using, I shall assume SQL Server 2000 as this is the most common on this forum. You can use sp_addlinkedserver[^] to establish the link to the other server, and then you can reference the server in your queries like this:
SELECT * FROM [MyOtherServer].[TheDatabase].[TheOwner].[TheTable]
TheOwner is usually
dbo
. Does this help?
My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More