Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 76587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:41:48+00:00 2026-05-10T20:41:48+00:00

How would you handle cross database queries in different environments. For example, db1-development and

  • 0

How would you handle cross database queries in different environments. For example, db1-development and db2-development, db1-production and db2-production.

If I want to do a cross-database query in development from db2 to db1 I could use the fully qualified name, [db1-development].[schema].[table]. But how do I maintain the queries and stored procedures between the different environments? [db1-development].[schema].[table] will not work in production because the database names are different.

I can see search and replace as a possible solution but I am hoping there is a more elegant way to solve this problem. If there are db specific solutions, I am using SQL Server 2005.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:41:49+00:00Added an answer on May 10, 2026 at 8:41 pm

    Why are the database names different between dev and prod? It’d, obviously, be easiest if they were the same.

    If it’s a single table shared, then you could create a view over it – which only requires that you change that view when moving to production.

    Otherwise, you’ll want to create a SYNONYM for the objects, and make sure to always reference that. You’ll still need to change the SYNONYM creation scripts, but that can be done in a build script fairly easily, I think.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It uses the Windows account information from the ASP.NET AppDomain… May 17, 2026 at 12:41 am
  • Editorial Team
    Editorial Team added an answer You should use jQuery.load() to load only a HTML fragment… May 17, 2026 at 12:41 am
  • Editorial Team
    Editorial Team added an answer Right so it looks like there is a bug with… May 17, 2026 at 12:41 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm looking for a cross-platform database engine that can handle databases up hundreds of
I am using this: SELECT * FROM sys.dm_exec_query_stats s CROSS APPLY sys.dm_exec_sql_text( s.sql_handle )
I'm coming from a background developing business applications so am used to MVC/n-Tier development.
I would like to create/use a system-wide independent universal 'counter object' that can be
I am having a difficult time deciding how to handle a business requirement in
I am assuming nhibernate can handle circular reference issues as I have not seen
I created an application as part of an ASP.NET site. I would like to
I'm having an implementation challenge at the moment, it basically consists of two different
So I have an interesting problem that's been the fruit of lots of good
I'm using Entity Framework in Visual Studio 2010 Beta 2 (.NET framework 4.0 Beta

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.