How can I remove the dbo prefix from my table names when I write my sql statements in SQL Server?

前端 未结 6 1516
一向
一向 2020-12-15 07:51

All the tables in my schema have a prefix of dbo. Now in my sql statements, I don\'t like using dbo.tablename all the time. Any workarounds or configuration changes?

6条回答
  •  感动是毒
    2020-12-15 08:28

    It's actually beneficial to leave the dbo. prefix in place - after all, in SQL Server, you could have several schemas (the "dbo." thingie) with the same table name, e.g. dbo.MyTable, joe.MyTable, frank.MyTable.

    If you then issue a SELECT (list of fields) FROM MyTable, SQL Server has to first figure out which of the "MyTable" tables you really mean --> this costs time, specifying right off the bat you want "dbo.MyTable" will SAVE you time.

    OK, not a lot on a single query - but SELECT queries are QUITE frequent and it all adds up!

    Marc

提交回复
热议问题