本文介绍了如何在SQL Server中的多个数据库中执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好, 如何在sql server中的多个数据库中执行存储过程 感谢
Hello, how to execute stored procedure in multiple databases in sql server thanks
推荐答案解决方案1将适用于多个数据库中的多个存储过程. 为了使存储过程访问其他数据库,应将数据库链接起来.然后,使用名称中的数据库来访问该数据库中的表. Solution 1 will work for multiple stored procedures in multiple databases. For a stored procedure to access a different database the database should be linked. Then to access the tables in that database use the database in the name. SELECT myColumn1 FROM [OtherServer\OtherInstance].[database].[schema].[table]
您可以执行以下操作: You can do the following : exec database1.dbo.usp_name1 exec database2.dbo.usp_name2 exec database3.dbo.usp_name3 -- continue like this as many times as you need
更多推荐
如何在SQL Server中的多个数据库中执行存储过程
发布评论