Sunday, February 19, 2012

<Tablename> . . <ColumnName>

Hi,
What is the difference between
<Tablename> . . <ColumnName> and <Tablename> . <ColumnName>
this syntax we are using in Storedprocedures.
In SQL 2000, <Tablename> . . <ColumnName> is not working

Eg:
Tablename =a
Column Name = b
Difference between a..b and a.b

Can anyone let me know.

TIA,
RaviThe difference would be that [Table].[Column] works, while [Table]..[Column] doesn't. At least I've never used syntax like that and I don't know of any reason why it would work.

I think you are getting this confused with table references, which may or may not include the object owner's name.

The full reference for an object (such as a table) is:
[Database].[Owner].[Object]

...but if the object is in the current database you can simply refer to it as
[Owner].[Object]

In either case, you are allowed to omit the owner. SQL Server will search first for an object owned by the current user, and if it cannot find one then it will search for an object that is owned by DBO:
[Database]..[Object]
or..
[Object]|||If you mean that your code refers to something like:SELECT name FROM master..sysdatabasesThe "master" is a database, the "sysdatabases" is a table, and the ".." implies either your own user or more likely dbo.

SQL Server has never allowed the use of tablename..columname in any circumstances that I remember.

-PatP

No comments:

Post a Comment