Craig
Craig

Reputation: 18684

What does the two dot before a table name mean

I've seen a query that looks like this:

Select Id from ..TableName where [Name] = @MyName

I can't seem to find when, or why this would be used. The query session is run against a database (So there is a USE already), and then 'TableName' is in both the default schema (dbo) as well as an audit schema (audit.TableName).

What would the .. mean in this case, and is it required / useful?

Upvotes: 1

Views: 408

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269513

SQL Server has a four-part naming convention for table references:

<server name>.<database name>.<schema name>.<table name>

Often the server is left off.

The .. occurs when you are happy to use the default schema in the database you are referencing. The default is usually dbo, but of course you can change it to something else. So, generally, it means:

from <current database>.dbo.TableName

Upvotes: 5

Related Questions