Re: Col_Name is not reporting from temp table...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Aaron Bertrand [MVP] (aaron_at_TRASHaspfaq.com)
Date: 04/04/04


Date: Sun, 4 Apr 2004 17:47:43 -0400

Let me ask again: Where does Books Online use functions like COL_NAME()
against a temp table? (Note: COL_NAME() != OBJECT_ID())

"JDP@Work" <JPGMTNoSpam@sbcglobal.net> wrote in message
news:%23qcMoheGEHA.4084@TK2MSFTNGP11.phx.gbl...
>
>
> Right to here......
>
> Transact-SQL Reference
>
> OBJECT_ID
> Returns the database object identification number.
>
> Syntax
> OBJECT_ID ( 'object' )
>
> Arguments
> 'object'
>
> Is the object to be used. object is either char or nchar. If object is
char, it
> is implicitly converted to nchar.
>
> Return Types
> int
>
> Remarks
> When the parameter to a system function is optional, the current database,
host
> computer, server user, or database user is assumed. Built-in functions
must
> always be followed by parentheses.
>
> When specifying a temporary table name, the database name must precede the
> temporary table name, for example:
>
> SELECT OBJECT_ID('tempdb..#mytemptable')
> System functions can be used in the select list, in the WHERE clause, and
> anywhere an expression is allowed. For more information, see Expressions
and
> WHERE.
>
> Examples
> This example returns the object ID for the authors table in the pubs
database.
>
> USE master
> SELECT OBJECT_ID('pubs..authors')
> Here is the result set:
>
> -----------
> 1977058079
>
> (1 row(s) affected)
>
> See Also
>
> Metadata Functions
>
> ©1988-2000 Microsoft Corporation. All Rights Reserved.
>
>
> "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
> news:OdZJvoZGEHA.2664@TK2MSFTNGP11.phx.gbl...
> > WHere does Books Online use functions like COL_NAME() against a temp
table?
> >
> > --
> > Aaron Bertrand
> > SQL Server MVP
> > http://www.aspfaq.com/
> >
> >
> > "JDP@Work" <JPGMTNoSpam@sbcglobal.net> wrote in message
> > news:ebV3jaZGEHA.2612@TK2MSFTNGP09.phx.gbl...
> > > Then why would BOL use that example?
> > >
> > > TIA
> > >
> > > JeffP....
> > >
> > >
> > > "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
> > > news:O0$xXAYGEHA.3188@TK2MSFTNGP10.phx.gbl...
> > >> > I might assume that the ID is valid but that col_Name may look to
the
> > >> > local
> > >> > database rather than the tempdb.
> > >>
> > >> Yes, I believe I said that is what happens...
> > >>
> > >> --
> > >> Aaron Bertrand
> > >> SQL Server MVP
> > >> http://www.aspfaq.com/
> > >>
> > >>
> > >
> > >
> >
> >
>
>
>



Relevant Pages

  • Re: Col_Name is not reporting from temp table...
    ... Returns the database object identification number. ... object is either char or nchar. ... computer, server user, or database user is assumed. ... > SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Col_Name is not reporting from temp table...
    ... >> Returns the database object identification number. ... object is either char or nchar. ... >> is implicitly converted to nchar. ... >> When the parameter to a system function is optional, ...
    (microsoft.public.sqlserver.programming)
  • Re: How to find the current database selected
    ... The system function call db_namewill return the current database name. ... Suresh Kumar wrote: ... >i.e what was the last USE command done before they inoked the stored proc? ...
    (microsoft.public.sqlserver.programming)
  • Re: Database recovery with data file only
    ... Basically using that command breaks your business logic as there's no ... "Dan Guzman" wrote in message ... >> database Backup as well as ... >>> SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: How critical is the transaction log file?
    ... Tibor Karaszi, SQL Server MVP ... file when you have only one file (no log file). ... circumstances it is supported to attach only an mdf file. ... > This development database that we're building does not have any 'user' ...
    (microsoft.public.sqlserver.tools)