Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 28-Oct-11 22:50pm
v2

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.
 
Share this answer
 
As I understood your question you want something like this :

SQL
use [Northwind]

exec AdventureWorks.dbo.uspGetManagerEmployees 109


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 :-?
 
Share this answer
 
Comments
K N R 29-Oct-11 4:52am    
hey amir,
am also getting no error. but how can i run this different databases
Mantu Singh 29-Oct-11 4:58am    
logging in to server with sysadmin role you have privilege over all database objects this may not be possible with a limited role account Best of luck......
K N R 29-Oct-11 5:00am    
THANK U...!!!
use [DB Name]

exec SpName
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900