Home Forums SQL Server 2008 SQL Server 2008 - General how to differentiate between two tables sharing the same name but belonging to different databases RE: how to differentiate between two tables sharing the same name but belonging to different databases

  • liteswitch (1/13/2014)


    I'd actually disagree with putting the database name in the 3 identifier, if the database gets renamed all the queries will fail, and that's a lot of effort to put right.

    I guess from my stand point if someone renamed a database I would want things to fail.

    If you're digging through thousands of lines of code and the connection was to 'databaseA' but somewhere in the code someone put a 'use databaseB' and you are looking for the table that needs 'fixing' you may look at the wrong table.

    I've ran into many issues here where the wrong tables get deleted or cleared out because someone didn't put all 3 parts.:w00t:

    I can convert the way I code for a lot of different things, but this is one of those things I don't think I will budge on.

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.