存储过程执行不同的数据库 [英] stored procedure execute different data bases

查看:141
本文介绍了存储过程执行不同的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在一个数据库中有一个存储过程.在数据库中查找上次运行的查询.
如何在不同的数据库中运行此存储过程.没有在任何数据库中创建sp(storedprocedure).

Hello,

I have one stored procedure in one database. To find last ran queries in database.
How to run this stored procedure in different databases. Am not creating sp(storedprocedure) in any database.

thanks.

推荐答案

因为我知道你做不到.但是,您可以复制该sp并将其部署到另一个DB,然后执行它.如果您需要更多有关实现此目标的详细信息,只需更新此问题即可.
For as I know you can''t. However you can copy that sp and deploy it to the other DB and then execute it. If you need more details on how to achieve that, just update this question.


据我了解您的问题,您需要这样的东西:

As I understood your question you want something like this :

use [Northwind]

exec AdventureWorks.dbo.uspGetManagerEmployees 109



但是执行此命令时我没有错误:-?在此命令中,我将在Northwind数据库上执行命令,但在AdventureWorks数据库中执行了存储过程,但没有出现错误:-?



But I got no error when executing this command :-? In this command I''m going to execute commands on Northwind database but executed a storedprocedure in AdventureWorks database and got no error :-?


使用[DB名称]

exec SpName
use [DB Name]

exec SpName


这篇关于存储过程执行不同的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆