When listing all the field names in the table, the following SQL function is used: object_id
Here I will list its functions and usage so that you can understand:
OBJECT_ID:
Returns the ID of the database object.
Syntax
OBJECT_ID ('object ')
Parameters
'Object'
The object to use. The object data type is char or nchar. If the object data type is char, It is implicitly converted to nchar.
Return type
Int
Note
When this parameter is optional for system functions, the system uses the current database, host, server user, or database user. The built-in function must be followed by parentheses.
If you specify a temporary table name, you must add a database name before the temporary table name. For example:
SELECT OBJECT_ID ('tempdb .. # mytemptable ')
System functions can be used in the selection list, WHERE clause, and any place WHERE expressions are allowed. For more information, see expressions and WHERE.
Example
The following example shows the ID of the object returned from the authors table in the pubs database.
USE master
SELECT OBJECT_ID ('pubs .. authors ')
The following is the result set:
-----------
1977058079
(1 row (s) affected)