tags:

views:

887

answers:

4

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?

A: 

I think the user in which you connect have to belong to dbo schema, and then you won't have to type the prefix, it will infer it from the schemas the user belong.

Jhonny D. Cano -Leftware-
In SQL 2005 and above, the same user can access to multiple schemas. What then?
Jose Basilio
+5  A: 

Actually you should leave those dbo. statements because you SQL will be faster since the optimizer doesn't have to lookup the schema

Check out this link also Performance Impact of Procedure Calls without Owner Qualification

SQLMenace
I'd give this many more upvotes if I could
HLGEM
A: 

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

marc_s
A: 

Dennis is right dbo is more efficient.

Honestly, how hard is it really to use .dbo. in place of.. ?

HLGEM