sp_help (Transact-SQL)sp_help (Transact-SQL)

适用于: 是SQL Server是Azure SQL 数据库否Azure SQL 数据仓库否并行数据仓库APPLIES TO: yesSQL Server yesAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

报告有关数据库对象的信息 (在中列出的所有对象sys.sysobjects兼容性视图),用户定义数据类型或数据类型。Reports information about a database object (any object listed in the sys.sysobjects compatibility view), a user-defined data type, or a data type.

主题链接图标 TRANSACT-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_help [ [ @objname = ] 'name' ]  

参数Arguments

[ @objname = ] 'name' 是中的任何对象名称sysobjects或中的任何用户定义数据类型systypes表。[ @objname = ] 'name' Is the name of any object, in sysobjects or any user-defined data type in the systypes table. 名称nvarchar ( 776 ) ,默认值为 NULL。name is nvarchar( 776 ), with a default of NULL. 不能接受数据库名称。Database names are not acceptable. 两个或三个部分的名称必须进行分隔,例如 'Person.AddressType' 或 [Person.AddressType]。Two or three part names must be delimited, such as 'Person.AddressType' or [Person.AddressType].

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

结果集Result Sets

返回的结果集取决于是否名称是指定,指定时,并且它是哪种数据库对象。The result sets that are returned depend on whether name is specified, when it is specified, and which database object it is.

  1. 如果sp_help执行不带任何参数,返回的当前数据库中存在的所有类型的对象的摘要信息。If sp_help is executed with no arguments, summary information of objects of all types that exist in the current database is returned.

    列名Column name 数据类型Data type 描述Description
    名称Name nvarchar( 128 )nvarchar( 128 ) 对象名称Object name
    “所有者”Owner nvarchar( 128 )nvarchar( 128 ) 对象所有者(拥有对象的数据库主体。Object owner (This is the database principal that owns object. 默认为包含对象的架构所有者。)Defaults to the owner of the schema that contains the object.)
    Object_typeObject_type nvarchar( 31 )nvarchar( 31 ) 对象类型Object type
  2. 如果名称SQL ServerSQL Server数据类型或用户定义数据类型sp_help返回以下结果集。If name is a SQL ServerSQL Server data type or user-defined data type, sp_help returns this result set.

    列名Column name 数据类型Data type 描述Description
    Type_nameType_name nvarchar( 128 )nvarchar( 128 ) 数据类型名称。Data type name.
    Storage_typeStorage_type nvarchar( 128 )nvarchar( 128 ) SQL ServerSQL Server 类型名称。type name.
    长度Length smallintsmallint 数据类型的物理长度(以字节为单位)。Physical length of the data type (in bytes).
    precPrec intint 精度(数字总位数)。Precision (total number of digits).
    小数位数Scale intint 在小数点右侧的数字的位数。Number of digits to the right of the decimal.
    可以为 NullNullable varchar( 35 )varchar( 35 ) 指示是否允许 NULL 值:是或否。Indicates whether NULL values are allowed: Yes or No.
    Default_nameDefault_name nvarchar( 128 )nvarchar( 128 ) 绑定到此类型的默认值的名称。Name of a default bound to this type.

    NULL = 未绑定默认值。NULL = No default is bound.
    Rule_nameRule_name nvarchar( 128 )nvarchar( 128 ) 绑定到此类型的规则的名称。Name of a rule bound to this type.

    NULL = 未绑定默认值。NULL = No default is bound.
    排序规则Collation sysnamesysname 数据类型的排序规则。Collation of the data type. 如果是非字符数据类型,则为 NULL。NULL for non-character data types.
  3. 如果名称是任何数据库对象,而数据类型,不sp_help返回此结果集和也更多结果集,基于指定的对象类型。If name is any database object other than a data type, sp_help returns this result set and also additional result sets, based on the type of object specified.

期待您的反馈 :如果在本文中发现过时或不正确的内容(如步骤或代码示例),请告诉我们。We are listening: If you find something outdated or incorrect in this article, such as a step or a code example, please tell us. 可以单击此页底部的“反馈” 部分中的“本页” 按钮。You can click the This page button in the Feedback section at the bottom of this page. 我们通常在第二天阅读有关 SQL 的每项反馈。We read every item of feedback about SQL, typically the next day. 谢谢。Thanks.

|<span data-ttu-id="8578b-164">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-164">Column name</span></span>|<span data-ttu-id="8578b-165">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-165">Data type</span></span>|<span data-ttu-id="8578b-166">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-166">Description</span></span>|  
|-----------------|---------------|-----------------|  
|<span data-ttu-id="8578b-167">**名称**</span><span class="sxs-lookup"><span data-stu-id="8578b-167">**Name**</span></span>|<span data-ttu-id="8578b-168">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-168">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-169">表名</span><span class="sxs-lookup"><span data-stu-id="8578b-169">Table name</span></span>|  
|<span data-ttu-id="8578b-170">**“所有者”**</span><span class="sxs-lookup"><span data-stu-id="8578b-170">**Owner**</span></span>|<span data-ttu-id="8578b-171">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-171">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-172">表所有者</span><span class="sxs-lookup"><span data-stu-id="8578b-172">Table owner</span></span>|  
|<span data-ttu-id="8578b-173">**类型**</span><span class="sxs-lookup"><span data-stu-id="8578b-173">**Type**</span></span>|<span data-ttu-id="8578b-174">**nvarchar(** 31 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-174">**nvarchar(** 31 **)**</span></span>|<span data-ttu-id="8578b-175">表类型</span><span class="sxs-lookup"><span data-stu-id="8578b-175">Table type</span></span>|  
|<span data-ttu-id="8578b-176">**Created_datetime**</span><span class="sxs-lookup"><span data-stu-id="8578b-176">**Created_datetime**</span></span>|<span data-ttu-id="8578b-177">**datetime**</span><span class="sxs-lookup"><span data-stu-id="8578b-177">**datetime**</span></span>|<span data-ttu-id="8578b-178">表的创建日期</span><span class="sxs-lookup"><span data-stu-id="8578b-178">Date table created</span></span>|  

 Depending on the database object specified, **sp_help** returns additional result sets.  

 If *name* is a system table, user table, or view, **sp_help** returns the following result sets. However, the result set that describes where the data file is located on a file group is not returned for a view.  

-   <span data-ttu-id="8578b-179">返回的有关列对象的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-179">Additional result set returned on column objects:</span></span>  

    |<span data-ttu-id="8578b-180">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-180">Column name</span></span>|<span data-ttu-id="8578b-181">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-181">Data type</span></span>|<span data-ttu-id="8578b-182">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-182">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-183">**Column_name**</span><span class="sxs-lookup"><span data-stu-id="8578b-183">**Column_name**</span></span>|<span data-ttu-id="8578b-184">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-184">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-185">列名称。</span><span class="sxs-lookup"><span data-stu-id="8578b-185">Column name.</span></span>|  
    |<span data-ttu-id="8578b-186">**类型**</span><span class="sxs-lookup"><span data-stu-id="8578b-186">**Type**</span></span>|<span data-ttu-id="8578b-187">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-187">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-188">列数据类型。</span><span class="sxs-lookup"><span data-stu-id="8578b-188">Column data type.</span></span>|  
    |<span data-ttu-id="8578b-189">**计算**</span><span class="sxs-lookup"><span data-stu-id="8578b-189">**Computed**</span></span>|<span data-ttu-id="8578b-190">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-190">**varchar(** 35 **)**</span></span>|<span data-ttu-id="8578b-191">指示是否计算列中的值:是或否。</span><span class="sxs-lookup"><span data-stu-id="8578b-191">Indicates whether the values in the column are computed: Yes or No.</span></span>|  
    |<span data-ttu-id="8578b-192">**长度**</span><span class="sxs-lookup"><span data-stu-id="8578b-192">**Length**</span></span>|<span data-ttu-id="8578b-193">**int**</span><span class="sxs-lookup"><span data-stu-id="8578b-193">**int**</span></span>|<span data-ttu-id="8578b-194">以字节为单位的列长度。</span><span class="sxs-lookup"><span data-stu-id="8578b-194">Column length in bytes.</span></span><br /><br /> <span data-ttu-id="8578b-195">注意:如果列数据类型是大值类型 (**varchar (max)** , **nvarchar (max)** , **varbinary (max)** ,或者**xml**),将的值显示为-1。</span><span class="sxs-lookup"><span data-stu-id="8578b-195">Note: If the column data type is a large value type (**varchar(max)**, **nvarchar(max)**, **varbinary(max)**, or **xml**), the value will display as -1.</span></span>|  
    |<span data-ttu-id="8578b-196">**prec**</span><span class="sxs-lookup"><span data-stu-id="8578b-196">**Prec**</span></span>|<span data-ttu-id="8578b-197">**char(** 5 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-197">**char(** 5 **)**</span></span>|<span data-ttu-id="8578b-198">列精度。</span><span class="sxs-lookup"><span data-stu-id="8578b-198">Column precision.</span></span>|  
    |<span data-ttu-id="8578b-199">**小数位数**</span><span class="sxs-lookup"><span data-stu-id="8578b-199">**Scale**</span></span>|<span data-ttu-id="8578b-200">**char(** 5 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-200">**char(** 5 **)**</span></span>|<span data-ttu-id="8578b-201">列小数位数。</span><span class="sxs-lookup"><span data-stu-id="8578b-201">Column scale.</span></span>|  
    |<span data-ttu-id="8578b-202">**可以为 Null**</span><span class="sxs-lookup"><span data-stu-id="8578b-202">**Nullable**</span></span>|<span data-ttu-id="8578b-203">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-203">**varchar(** 35 **)**</span></span>|<span data-ttu-id="8578b-204">指示列中是否允许 NULL 值:是或否。</span><span class="sxs-lookup"><span data-stu-id="8578b-204">Indicates whether NULL values are allowed in the column: Yes or No.</span></span>|  
    |<span data-ttu-id="8578b-205">**TrimTrailingBlanks**</span><span class="sxs-lookup"><span data-stu-id="8578b-205">**TrimTrailingBlanks**</span></span>|<span data-ttu-id="8578b-206">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-206">**varchar(** 35 **)**</span></span>|<span data-ttu-id="8578b-207">剪裁尾随空格。</span><span class="sxs-lookup"><span data-stu-id="8578b-207">Trim the trailing blanks.</span></span> <span data-ttu-id="8578b-208">返回 Yes 或 No。</span><span class="sxs-lookup"><span data-stu-id="8578b-208">Returns Yes or No.</span></span>|  
    |<span data-ttu-id="8578b-209">**FixedLenNullInSource**</span><span class="sxs-lookup"><span data-stu-id="8578b-209">**FixedLenNullInSource**</span></span>|<span data-ttu-id="8578b-210">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-210">**varchar(** 35 **)**</span></span>|<span data-ttu-id="8578b-211">仅为保持向后兼容。</span><span class="sxs-lookup"><span data-stu-id="8578b-211">For backward compatibility only.</span></span>|  
    |<span data-ttu-id="8578b-212">**排序规则**</span><span class="sxs-lookup"><span data-stu-id="8578b-212">**Collation**</span></span>|<span data-ttu-id="8578b-213">**sysname**</span><span class="sxs-lookup"><span data-stu-id="8578b-213">**sysname**</span></span>|<span data-ttu-id="8578b-214">列的排序规则。</span><span class="sxs-lookup"><span data-stu-id="8578b-214">Collation of the column.</span></span> <span data-ttu-id="8578b-215">对于非字符数据类性为 NULL。</span><span class="sxs-lookup"><span data-stu-id="8578b-215">NULL for noncharacter data types.</span></span>|  

-   <span data-ttu-id="8578b-216">针对标识列返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-216">Additional result set returned on identity columns:</span></span>  

    |<span data-ttu-id="8578b-217">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-217">Column name</span></span>|<span data-ttu-id="8578b-218">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-218">Data type</span></span>|<span data-ttu-id="8578b-219">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-219">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-220">**标识**</span><span class="sxs-lookup"><span data-stu-id="8578b-220">**Identity**</span></span>|<span data-ttu-id="8578b-221">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-221">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-222">其数据类型被声明为标识的列名。</span><span class="sxs-lookup"><span data-stu-id="8578b-222">Column name whose data type is declared as identity.</span></span>|  
    |<span data-ttu-id="8578b-223">**种子**</span><span class="sxs-lookup"><span data-stu-id="8578b-223">**Seed**</span></span>|<span data-ttu-id="8578b-224">**numeric**</span><span class="sxs-lookup"><span data-stu-id="8578b-224">**numeric**</span></span>|<span data-ttu-id="8578b-225">标识列的起始值。</span><span class="sxs-lookup"><span data-stu-id="8578b-225">Starting value for the identity column.</span></span>|  
    |<span data-ttu-id="8578b-226">**增量**</span><span class="sxs-lookup"><span data-stu-id="8578b-226">**Increment**</span></span>|<span data-ttu-id="8578b-227">**numeric**</span><span class="sxs-lookup"><span data-stu-id="8578b-227">**numeric**</span></span>|<span data-ttu-id="8578b-228">用于此列中的值的增量。</span><span class="sxs-lookup"><span data-stu-id="8578b-228">Increment to use for values in this column.</span></span>|  
    |<span data-ttu-id="8578b-229">**不用于复制**</span><span class="sxs-lookup"><span data-stu-id="8578b-229">**Not For Replication**</span></span>|<span data-ttu-id="8578b-230">**int**</span><span class="sxs-lookup"><span data-stu-id="8578b-230">**int**</span></span>|<span data-ttu-id="8578b-231">IDENTITY 属性不强制使用时复制登录名,如**sqlrepl**,将数据插入到表:</span><span class="sxs-lookup"><span data-stu-id="8578b-231">IDENTITY property is not enforced when a replication login, such as **sqlrepl**, inserts data into the table:</span></span><br /><br /> <span data-ttu-id="8578b-232">1 = True</span><span class="sxs-lookup"><span data-stu-id="8578b-232">1 = True</span></span><br /><br /> <span data-ttu-id="8578b-233">0 = False</span><span class="sxs-lookup"><span data-stu-id="8578b-233">0 = False</span></span>|  

-   <span data-ttu-id="8578b-234">针对各列返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-234">Additional result set returned on columns:</span></span>  

    |<span data-ttu-id="8578b-235">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-235">Column name</span></span>|<span data-ttu-id="8578b-236">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-236">Data type</span></span>|<span data-ttu-id="8578b-237">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-237">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-238">**RowGuidCol**</span><span class="sxs-lookup"><span data-stu-id="8578b-238">**RowGuidCol**</span></span>|<span data-ttu-id="8578b-239">**sysname**</span><span class="sxs-lookup"><span data-stu-id="8578b-239">**sysname**</span></span>|<span data-ttu-id="8578b-240">全局唯一标识符列的名称。</span><span class="sxs-lookup"><span data-stu-id="8578b-240">Name of the global unique identifier column.</span></span>|  

-   <span data-ttu-id="8578b-241">针对文件组返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-241">Additional result set returned on filegroups:</span></span>  

    |<span data-ttu-id="8578b-242">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-242">Column name</span></span>|<span data-ttu-id="8578b-243">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-243">Data type</span></span>|<span data-ttu-id="8578b-244">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-244">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-245">**Data_located_on_filegroup**</span><span class="sxs-lookup"><span data-stu-id="8578b-245">**Data_located_on_filegroup**</span></span>|<span data-ttu-id="8578b-246">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-246">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-247">数据所在的文件组:主要副本,辅助数据库或事务日志。</span><span class="sxs-lookup"><span data-stu-id="8578b-247">Filegroup in which the data is located: Primary, Secondary, or Transaction Log.</span></span>|  

-   <span data-ttu-id="8578b-248">针对索引返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-248">Additional result set returned on indexes:</span></span>  

    |<span data-ttu-id="8578b-249">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-249">Column name</span></span>|<span data-ttu-id="8578b-250">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-250">Data type</span></span>|<span data-ttu-id="8578b-251">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-251">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-252">**index_name**</span><span class="sxs-lookup"><span data-stu-id="8578b-252">**index_name**</span></span>|<span data-ttu-id="8578b-253">**sysname**</span><span class="sxs-lookup"><span data-stu-id="8578b-253">**sysname**</span></span>|<span data-ttu-id="8578b-254">索引名。</span><span class="sxs-lookup"><span data-stu-id="8578b-254">Index name.</span></span>|  
    |<span data-ttu-id="8578b-255">**Index_description**</span><span class="sxs-lookup"><span data-stu-id="8578b-255">**Index_description**</span></span>|<span data-ttu-id="8578b-256">**varchar(** 210 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-256">**varchar(** 210 **)**</span></span>|<span data-ttu-id="8578b-257">索引的说明。</span><span class="sxs-lookup"><span data-stu-id="8578b-257">Description of the index.</span></span>|  
    |<span data-ttu-id="8578b-258">**index_keys**</span><span class="sxs-lookup"><span data-stu-id="8578b-258">**index_keys**</span></span>|<span data-ttu-id="8578b-259">**nvarchar(** 2078 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-259">**nvarchar(** 2078 **)**</span></span>|<span data-ttu-id="8578b-260">要生成索引的列的列名。</span><span class="sxs-lookup"><span data-stu-id="8578b-260">Column names on which the index is built.</span></span> <span data-ttu-id="8578b-261">对于 xVelocity 内存优化的列存储索引返回 NULL。</span><span class="sxs-lookup"><span data-stu-id="8578b-261">Returns NULL for xVelocity memory optimized columnstore indexes.</span></span>|  

-   <span data-ttu-id="8578b-262">针对约束返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-262">Additional result set returned on constraints:</span></span>  

    |<span data-ttu-id="8578b-263">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-263">Column name</span></span>|<span data-ttu-id="8578b-264">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-264">Data type</span></span>|<span data-ttu-id="8578b-265">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-265">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-266">**constraint_type**</span><span class="sxs-lookup"><span data-stu-id="8578b-266">**constraint_type**</span></span>|<span data-ttu-id="8578b-267">**nvarchar(** 146 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-267">**nvarchar(** 146 **)**</span></span>|<span data-ttu-id="8578b-268">约束的类型。</span><span class="sxs-lookup"><span data-stu-id="8578b-268">Type of constraint.</span></span>|  
    |<span data-ttu-id="8578b-269">**constraint_name**</span><span class="sxs-lookup"><span data-stu-id="8578b-269">**constraint_name**</span></span>|<span data-ttu-id="8578b-270">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-270">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-271">约束的名称。</span><span class="sxs-lookup"><span data-stu-id="8578b-271">Name of the constraint.</span></span>|  
    |<span data-ttu-id="8578b-272">**delete_action**</span><span class="sxs-lookup"><span data-stu-id="8578b-272">**delete_action**</span></span>|<span data-ttu-id="8578b-273">**nvarchar(** 9 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-273">**nvarchar(** 9 **)**</span></span>|<span data-ttu-id="8578b-274">指示 DELETE 操作是:NO_ACTION、 CASCADE、 SET_NULL、 SET_DEFAULT 还是 n/A。</span><span class="sxs-lookup"><span data-stu-id="8578b-274">Indicates whether the DELETE action is: NO_ACTION, CASCADE, SET_NULL, SET_DEFAULT, or N/A.</span></span><br /><br /> <span data-ttu-id="8578b-275">仅适用于 FOREIGN KEY 约束。</span><span class="sxs-lookup"><span data-stu-id="8578b-275">Only applicable to FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="8578b-276">**update_action**</span><span class="sxs-lookup"><span data-stu-id="8578b-276">**update_action**</span></span>|<span data-ttu-id="8578b-277">**nvarchar(** 9 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-277">**nvarchar(** 9 **)**</span></span>|<span data-ttu-id="8578b-278">指示 UPDATE 操作是:NO_ACTION、 CASCADE、 SET_NULL、 SET_DEFAULT 还是 n/A。</span><span class="sxs-lookup"><span data-stu-id="8578b-278">Indicates whether the UPDATE action is: NO_ACTION, CASCADE, SET_NULL, SET_DEFAULT, or N/A.</span></span><br /><br /> <span data-ttu-id="8578b-279">仅适用于 FOREIGN KEY 约束。</span><span class="sxs-lookup"><span data-stu-id="8578b-279">Only applicable to FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="8578b-280">**status_enabled**</span><span class="sxs-lookup"><span data-stu-id="8578b-280">**status_enabled**</span></span>|<span data-ttu-id="8578b-281">**varchar(** 8 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-281">**varchar(** 8 **)**</span></span>|<span data-ttu-id="8578b-282">指示是否启用约束:Enabled、 Disabled 或 n/A。</span><span class="sxs-lookup"><span data-stu-id="8578b-282">Indicates whether the constraint is enabled: Enabled, Disabled, or N/A.</span></span><br /><br /> <span data-ttu-id="8578b-283">仅适用于 CHECK 和 FOREIGN KEY 约束。</span><span class="sxs-lookup"><span data-stu-id="8578b-283">Only applicable to CHECK and FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="8578b-284">**status_for_replication**</span><span class="sxs-lookup"><span data-stu-id="8578b-284">**status_for_replication**</span></span>|<span data-ttu-id="8578b-285">**varchar(** 19 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-285">**varchar(** 19 **)**</span></span>|<span data-ttu-id="8578b-286">指示约束是否用于复制。</span><span class="sxs-lookup"><span data-stu-id="8578b-286">Indicates whether the constraint is for replication.</span></span><br /><br /> <span data-ttu-id="8578b-287">仅适用于 CHECK 和 FOREIGN KEY 约束。</span><span class="sxs-lookup"><span data-stu-id="8578b-287">Only applicable to CHECK and FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="8578b-288">**constraint_keys**</span><span class="sxs-lookup"><span data-stu-id="8578b-288">**constraint_keys**</span></span>|<span data-ttu-id="8578b-289">**nvarchar(** 2078 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-289">**nvarchar(** 2078 **)**</span></span>|<span data-ttu-id="8578b-290">构成约束的列的名称。对于默认值和规则而言,则为定义默认值或规则的文本。</span><span class="sxs-lookup"><span data-stu-id="8578b-290">Names of the columns that make up the constraint or, in the case for defaults and rules, the text that defines the default or rule.</span></span>|  

-   <span data-ttu-id="8578b-291">针对执行引用的对象返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-291">Additional result set returned on referencing objects:</span></span>  

    |<span data-ttu-id="8578b-292">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-292">Column name</span></span>|<span data-ttu-id="8578b-293">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-293">Data type</span></span>|<span data-ttu-id="8578b-294">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-294">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-295">**引用表**</span><span class="sxs-lookup"><span data-stu-id="8578b-295">**Table is referenced by**</span></span>|<span data-ttu-id="8578b-296">**nvarchar(** 516 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-296">**nvarchar(** 516 **)**</span></span>|<span data-ttu-id="8578b-297">标识引用表的其他数据库对象。</span><span class="sxs-lookup"><span data-stu-id="8578b-297">Identifies other database objects that reference the table.</span></span>|  

-   <span data-ttu-id="8578b-298">针对存储过程、函数或扩展存储过程返回的其他结果集:</span><span class="sxs-lookup"><span data-stu-id="8578b-298">Additional result set returned on stored procedures, functions, or extended stored procedures.</span></span>  

    |<span data-ttu-id="8578b-299">列名</span><span class="sxs-lookup"><span data-stu-id="8578b-299">Column name</span></span>|<span data-ttu-id="8578b-300">数据类型</span><span class="sxs-lookup"><span data-stu-id="8578b-300">Data type</span></span>|<span data-ttu-id="8578b-301">描述</span><span class="sxs-lookup"><span data-stu-id="8578b-301">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="8578b-302">**参数名称**</span><span class="sxs-lookup"><span data-stu-id="8578b-302">**Parameter_name**</span></span>|<span data-ttu-id="8578b-303">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-303">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-304">存储过程参数名。</span><span class="sxs-lookup"><span data-stu-id="8578b-304">Stored procedure parameter name.</span></span>|  
    |<span data-ttu-id="8578b-305">**类型**</span><span class="sxs-lookup"><span data-stu-id="8578b-305">**Type**</span></span>|<span data-ttu-id="8578b-306">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="8578b-306">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="8578b-307">存储过程参数的数据类型。</span><span class="sxs-lookup"><span data-stu-id="8578b-307">Data type of the stored procedure parameter.</span></span>|  
    |<span data-ttu-id="8578b-308">**长度**</span><span class="sxs-lookup"><span data-stu-id="8578b-308">**Length**</span></span>|<span data-ttu-id="8578b-309">**smallint**</span><span class="sxs-lookup"><span data-stu-id="8578b-309">**smallint**</span></span>|<span data-ttu-id="8578b-310">最大物理存储长度(以字节为单位)。</span><span class="sxs-lookup"><span data-stu-id="8578b-310">Maximum physical storage length, in bytes.</span></span>|  
    |<span data-ttu-id="8578b-311">**prec**</span><span class="sxs-lookup"><span data-stu-id="8578b-311">**Prec**</span></span>|<span data-ttu-id="8578b-312">**int**</span><span class="sxs-lookup"><span data-stu-id="8578b-312">**int**</span></span>|<span data-ttu-id="8578b-313">精度,即数字总位数。</span><span class="sxs-lookup"><span data-stu-id="8578b-313">Precision or total number of digits.</span></span>|  
    |<span data-ttu-id="8578b-314">**小数位数**</span><span class="sxs-lookup"><span data-stu-id="8578b-314">**Scale**</span></span>|<span data-ttu-id="8578b-315">**int**</span><span class="sxs-lookup"><span data-stu-id="8578b-315">**int**</span></span>|<span data-ttu-id="8578b-316">小数点右边的数字位数。</span><span class="sxs-lookup"><span data-stu-id="8578b-316">Number of digits to the right of the decimal point.</span></span>|  
    |<span data-ttu-id="8578b-317">**Param_order**</span><span class="sxs-lookup"><span data-stu-id="8578b-317">**Param_order**</span></span>|<span data-ttu-id="8578b-318">**smallint**</span><span class="sxs-lookup"><span data-stu-id="8578b-318">**smallint**</span></span>|<span data-ttu-id="8578b-319">参数的顺序。</span><span class="sxs-lookup"><span data-stu-id="8578b-319">Order of the parameter.</span></span>|  

备注Remarks

Sp_help过程查找当前数据库中的对象。The sp_help procedure looks for an object in the current database only.

名称未指定,则sp_help列出的对象名称、 所有者和当前数据库中的所有对象的对象类型。When name is not specified, sp_help lists object names, owners, and object types for all objects in the current database. sp_helptrigger提供有关触发器的信息。sp_helptrigger provides information about triggers.

sp_help只显示可排序的索引列; 因此,不显示关于 XML 索引或空间索引的信息。sp_help exposes only orderable index columns; therefore, it does not expose information about XML indexes or spatial indexes.

权限Permissions

要求 公共 角色具有成员身份。Requires membership in the public role. 用户必须具有至少一个权限objnameThe user must have at least one permission on objname. 若要查看列约束键、默认值或规则,必须对表具有 VIEW DEFINITION 权限。To view column constraint keys, defaults, or rules, you must have VIEW DEFINITION permission on the table.

示例Examples

A.A. 返回有关所有对象的信息Returning information about all objects

以下示例将列出有关 master 数据库中每个对象的信息。The following example lists information about each object in the master database.

USE master;  
GO  
EXEC sp_help;  
GO  

B.B. 返回有关单个对象的信息Returning information about a single object

以下示例将显示有关 Person 表的信息。The following example displays information about the Person table.

USE AdventureWorks2012;  
GO  
EXEC sp_help 'Person.Person';  
GO  

请参阅See Also

数据库引擎存储过程(Transact SQL) Database Engine Stored Procedures (Transact-SQL)
sp_helpindex (TRANSACT-SQL) sp_helpindex (Transact-SQL)
sp_helprotect (Transact-SQL) sp_helprotect (Transact-SQL)
sp_helpserver (Transact-SQL) sp_helpserver (Transact-SQL)
sp_helptrigger (Transact-SQL) sp_helptrigger (Transact-SQL)
sp_helpuser (TRANSACT-SQL) sp_helpuser (Transact-SQL)
系统存储过程 (Transact-SQL) System Stored Procedures (Transact-SQL)
sys.sysobjects (Transact-SQL)sys.sysobjects (Transact-SQL)