TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Saranya J
NA
15
0
SQL: Creating Dynamic database connection
Jul 24 2010 1:53 PM
How to connect with tables in different database without hardcoding the database name in the query. I would like to have the query to get the database name in a variable or parameter and use anywhere within the script.
For example:
select
*
from
titles
cross
join
northwind
.
dbo
.
orders
Here northwind dbo name is hardcoded. But this northwind may change to any database name at run time. I would like to keep that in a variable or parameter and get that according to the requirements anywhere in the script. May be in a single transaction or from the cursor... Any help much appreciated... Thanks in advance.
Reply
Answers (
1
)
Looping through each record and modifying
How do I connect to my database on my website?