You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the specified part of an object name. The parts of an object that can be retrieved are the object name, owner name, database name, and server name.
29
+
Returns the specified part of an object name. The parts of an object that can be retrieved are the object name, schema name, database name, and server name.
30
30
31
31
> [!NOTE]
32
32
> The PARSENAME function does not indicate whether an object by the specified name exists. PARSENAME just returns the specified part of the specified object name.
Is the name of the object for which to retrieve the specified object part. *object_name* is **sysname**. This parameter is an optionally-qualified object name. If all parts of the object name are qualified, this name can have four parts: the server name, the database name, the owner name, and the object name.
45
-
46
-
*object_piece*
47
-
Is the object part to return. *object_piece* is of type **int**, and can have these values:
48
41
49
-
1 = Object name
50
-
51
-
2 = Schema name
52
-
53
-
3 = Database name
42
+
## Arguments
43
+
44
+
*'object_name'*
45
+
Is the parameter that holds the name of the object for which to retrieve the specified object part. This parameter is an optionally-qualified object name. If all parts of the object name are qualified, this name can have four parts: the server name, the database name, the schema name, and the object name. Each part of the 'object_name' string is type *sysname* which is equivalent to nvarchar(128) or 256 bytes. If any part of the string exceeds 256 bytes, PARSENAME will return NULL for that part as it is not a valid sysname.
54
46
55
-
4 = Server name
47
+
*object_piece*
48
+
Is the object part to return. *object_piece* is of type **int**, and can have these values:
49
+
1 = Object name
50
+
2 = Schema name
51
+
3 = Database name
52
+
4 = Server name
56
53
57
-
## Return Types
58
-
**sysname**
54
+
## Return Type
55
+
56
+
**sysname**
59
57
60
-
## Remarks
58
+
## Remarks
59
+
61
60
PARSENAME returns NULL if one of the following conditions is true:
The requested object part has a length of 0 and is not a valid [!INCLUDE[msCoName](../../includes/msconame-md.md)][!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] identifier. A zero-length object name renders the complete qualified name as not valid.
68
67
69
-
## Examples
68
+
## Examples
69
+
70
70
The following example uses `PARSENAME` to return information about the `Person` table in the `AdventureWorks2012` database.
0 commit comments