Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

OBJECT_ID

SQL Server 2000

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft