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
'
|