Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How can I use database dynamically

Author  Topic 

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2008-10-26 : 04:07:40
for example

"mydb1" and "mydb2" are separate databases in sqlserver2005.

hear my doubt is how can i use perticular database
dynamically...

my idea is "write a stored proc and pass inputstring to that"
can any one implement that please.....

malaytech2008
Yak Posting Veteran

95 Posts

Posted - 2008-10-26 : 05:58:11
Can u please give more information in what situation u need that and what kind information u want to pull from the DB.

malay
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-26 : 07:00:09
if you attempt is to run query on multiple databases the best method is to use undocumented stored procedure sp_Msforeachdb. refer below link

http://www.databasejournal.com/features/mssql/article.php/3441031
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-29 : 04:57:11
Also refer
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/05/13/simulating-undocumented-procedures.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -