Set a DB as the "Active" DB

  • Hi there,

    I have about a dozen databases on my server and I was wondering if it was possible to set a specific DB as the "active" one. If a DB is "active", I would no longer have to reference its actual DB name and the schema the table I want to pull belongs to (ie. from "mydatabase.myschema.table1" → "table1")

  • No such concept as 'active' database.

    For objects in your connection's current database you don't need to specify the database name. For objects from another, then it does need to specify the database name.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • How do I change the current connection to a different database?

  • USE

    Did you try searching first?


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Search on 'default database' and 'initial catalog'.

    ----------------------------------------------------------------------------
    Sacramento SQL Server users group - http://sac.sqlpass.org
    Follow me on Twitter - @SQLDCH
    ----------------------------------------------------------------------------

    Yeah, well...The Dude abides.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply