Two part name joins for three part name data tables

NiallNiall Posts: 36 Bronze 1
edited April 14, 2011 5:10AM in SQL Prompt Previous Versions
Having a database building database I frequently access external database schemas from the build database. So for instance where I have a database called External_DB I may use the following query..


Select {something usefull} from External_DB.sys.tables inner join External_DB.sys.schemas on tables.schema_id = schemas.schema_id.... and so ona nd so forth.

When naming the join criteria in this scenario I can alias the sources, but am generally can't be bothered, so I am stuck with using either two part (tables.schema_id) of four part (External_DB.sys.tables.schema_id) naming convention . 'Tis a real pain then that Red gate tries three part (sys.tables.schema_id) naming which is in this case illegal as the names cannot be resolved. :roll:

I suppose in case I am going across DB's then it (SQL Prompt) should use 4 part, well that is until I can get into the habit of aliasing.....

Comments

Sign In or Register to comment.