views:

41

answers:

1

Hello all,

Is this valid dbo.dbo, if so what does it mean? I have spoted this on a query that someone else wrote:

from dbo.tmp_BDCode aob inner join dbo.dbo.tmp_BDCode_03 ao

Would it have an adverse effect on a query, because dbo just means its a global object.

Thanks all for clarification on this.

+2  A: 

There may be a database named dbo or schema named dbo.dbo or a table named dbo.tablename.

These commands are valid:

create database dbo
use dbo
create schema [dbo.dbo]
create table [dbo.dbo].[dbo.tablename] (id int, name varchar(10))

select * from [dbo.dbo].[dbo.tablename] as dt
select * from dbo.[dbo.dbo].[dbo.tablename] as dt

It definitely has an adverse effect of not being clear enough to the programmers that will have to read this source code afterwards.

Denis Valeev
Even if they are valid, this is a pretty poor naming convention...
JNK
Valid: Yes. Sane: No. Anyone who pulled a stunt like this on one of my servers would get 40 lashes with a wet noodle.
Joe Stefanelli
Unless he took out brackets by himself, the only way that will run is if there is a database named dbo, right?
Mike M.
@Joe Stefanelli hahah! very funny!
Denis Valeev
lol thanks for the clarification Denis!
Abs