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

適用於: 是SQL Server 是Azure SQL Database 否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 值:Yes 或 no。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="97512-164">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-164">Column name</span></span>|<span data-ttu-id="97512-165">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-165">Data type</span></span>|<span data-ttu-id="97512-166">描述</span><span class="sxs-lookup"><span data-stu-id="97512-166">Description</span></span>|  
|-----------------|---------------|-----------------|  
|<span data-ttu-id="97512-167">**名稱**</span><span class="sxs-lookup"><span data-stu-id="97512-167">**Name**</span></span>|<span data-ttu-id="97512-168">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-168">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-169">資料表名稱</span><span class="sxs-lookup"><span data-stu-id="97512-169">Table name</span></span>|  
|<span data-ttu-id="97512-170">**[擁有者]**</span><span class="sxs-lookup"><span data-stu-id="97512-170">**Owner**</span></span>|<span data-ttu-id="97512-171">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-171">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-172">資料表擁有者</span><span class="sxs-lookup"><span data-stu-id="97512-172">Table owner</span></span>|  
|<span data-ttu-id="97512-173">**型別**</span><span class="sxs-lookup"><span data-stu-id="97512-173">**Type**</span></span>|<span data-ttu-id="97512-174">**nvarchar(** 31 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-174">**nvarchar(** 31 **)**</span></span>|<span data-ttu-id="97512-175">資料表類型</span><span class="sxs-lookup"><span data-stu-id="97512-175">Table type</span></span>|  
|<span data-ttu-id="97512-176">**Created_datetime**</span><span class="sxs-lookup"><span data-stu-id="97512-176">**Created_datetime**</span></span>|<span data-ttu-id="97512-177">**datetime**</span><span class="sxs-lookup"><span data-stu-id="97512-177">**datetime**</span></span>|<span data-ttu-id="97512-178">資料表的建立日期</span><span class="sxs-lookup"><span data-stu-id="97512-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="97512-179">在資料行物件上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-179">Additional result set returned on column objects:</span></span>  

    |<span data-ttu-id="97512-180">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-180">Column name</span></span>|<span data-ttu-id="97512-181">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-181">Data type</span></span>|<span data-ttu-id="97512-182">描述</span><span class="sxs-lookup"><span data-stu-id="97512-182">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-183">**Column_name**</span><span class="sxs-lookup"><span data-stu-id="97512-183">**Column_name**</span></span>|<span data-ttu-id="97512-184">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-184">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-185">資料行名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-185">Column name.</span></span>|  
    |<span data-ttu-id="97512-186">**型別**</span><span class="sxs-lookup"><span data-stu-id="97512-186">**Type**</span></span>|<span data-ttu-id="97512-187">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-187">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-188">資料行資料類型。</span><span class="sxs-lookup"><span data-stu-id="97512-188">Column data type.</span></span>|  
    |<span data-ttu-id="97512-189">**計算**</span><span class="sxs-lookup"><span data-stu-id="97512-189">**Computed**</span></span>|<span data-ttu-id="97512-190">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-190">**varchar(** 35 **)**</span></span>|<span data-ttu-id="97512-191">指出是否計算資料行的值:Yes 或 no。</span><span class="sxs-lookup"><span data-stu-id="97512-191">Indicates whether the values in the column are computed: Yes or No.</span></span>|  
    |<span data-ttu-id="97512-192">**長度**</span><span class="sxs-lookup"><span data-stu-id="97512-192">**Length**</span></span>|<span data-ttu-id="97512-193">**int**</span><span class="sxs-lookup"><span data-stu-id="97512-193">**int**</span></span>|<span data-ttu-id="97512-194">資料行長度 (以位元組為單位)。</span><span class="sxs-lookup"><span data-stu-id="97512-194">Column length in bytes.</span></span><br /><br /> <span data-ttu-id="97512-195">注意:如果資料行資料類型是大數值類型 (**varchar (max)** , **nvarchar (max)** , **varbinary (max)** ,或**xml**),將值顯示為-1。</span><span class="sxs-lookup"><span data-stu-id="97512-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="97512-196">**prec**</span><span class="sxs-lookup"><span data-stu-id="97512-196">**Prec**</span></span>|<span data-ttu-id="97512-197">**char(** 5 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-197">**char(** 5 **)**</span></span>|<span data-ttu-id="97512-198">資料行有效位數。</span><span class="sxs-lookup"><span data-stu-id="97512-198">Column precision.</span></span>|  
    |<span data-ttu-id="97512-199">**小數位數**</span><span class="sxs-lookup"><span data-stu-id="97512-199">**Scale**</span></span>|<span data-ttu-id="97512-200">**char(** 5 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-200">**char(** 5 **)**</span></span>|<span data-ttu-id="97512-201">資料行小數位數。</span><span class="sxs-lookup"><span data-stu-id="97512-201">Column scale.</span></span>|  
    |<span data-ttu-id="97512-202">**可為 Null**</span><span class="sxs-lookup"><span data-stu-id="97512-202">**Nullable**</span></span>|<span data-ttu-id="97512-203">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-203">**varchar(** 35 **)**</span></span>|<span data-ttu-id="97512-204">指出資料行是否允許 NULL 值:Yes 或 no。</span><span class="sxs-lookup"><span data-stu-id="97512-204">Indicates whether NULL values are allowed in the column: Yes or No.</span></span>|  
    |<span data-ttu-id="97512-205">**TrimTrailingBlanks**</span><span class="sxs-lookup"><span data-stu-id="97512-205">**TrimTrailingBlanks**</span></span>|<span data-ttu-id="97512-206">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-206">**varchar(** 35 **)**</span></span>|<span data-ttu-id="97512-207">修剪尾端空白。</span><span class="sxs-lookup"><span data-stu-id="97512-207">Trim the trailing blanks.</span></span> <span data-ttu-id="97512-208">傳回 [是] 或 [否]。</span><span class="sxs-lookup"><span data-stu-id="97512-208">Returns Yes or No.</span></span>|  
    |<span data-ttu-id="97512-209">**FixedLenNullInSource**</span><span class="sxs-lookup"><span data-stu-id="97512-209">**FixedLenNullInSource**</span></span>|<span data-ttu-id="97512-210">**varchar(** 35 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-210">**varchar(** 35 **)**</span></span>|<span data-ttu-id="97512-211">只是為了與舊版相容。</span><span class="sxs-lookup"><span data-stu-id="97512-211">For backward compatibility only.</span></span>|  
    |<span data-ttu-id="97512-212">**定序**</span><span class="sxs-lookup"><span data-stu-id="97512-212">**Collation**</span></span>|<span data-ttu-id="97512-213">**sysname**</span><span class="sxs-lookup"><span data-stu-id="97512-213">**sysname**</span></span>|<span data-ttu-id="97512-214">資料行的定序。</span><span class="sxs-lookup"><span data-stu-id="97512-214">Collation of the column.</span></span> <span data-ttu-id="97512-215">非字元資料類型是 NULL。</span><span class="sxs-lookup"><span data-stu-id="97512-215">NULL for noncharacter data types.</span></span>|  

-   <span data-ttu-id="97512-216">在識別欄位上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-216">Additional result set returned on identity columns:</span></span>  

    |<span data-ttu-id="97512-217">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-217">Column name</span></span>|<span data-ttu-id="97512-218">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-218">Data type</span></span>|<span data-ttu-id="97512-219">描述</span><span class="sxs-lookup"><span data-stu-id="97512-219">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-220">**識別**</span><span class="sxs-lookup"><span data-stu-id="97512-220">**Identity**</span></span>|<span data-ttu-id="97512-221">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-221">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-222">資料類型宣告為識別的資料行名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-222">Column name whose data type is declared as identity.</span></span>|  
    |<span data-ttu-id="97512-223">**識別值種子**</span><span class="sxs-lookup"><span data-stu-id="97512-223">**Seed**</span></span>|<span data-ttu-id="97512-224">**numeric**</span><span class="sxs-lookup"><span data-stu-id="97512-224">**numeric**</span></span>|<span data-ttu-id="97512-225">識別欄位的起始值。</span><span class="sxs-lookup"><span data-stu-id="97512-225">Starting value for the identity column.</span></span>|  
    |<span data-ttu-id="97512-226">**[遞增]**</span><span class="sxs-lookup"><span data-stu-id="97512-226">**Increment**</span></span>|<span data-ttu-id="97512-227">**numeric**</span><span class="sxs-lookup"><span data-stu-id="97512-227">**numeric**</span></span>|<span data-ttu-id="97512-228">這個資料行的值所用的遞增。</span><span class="sxs-lookup"><span data-stu-id="97512-228">Increment to use for values in this column.</span></span>|  
    |<span data-ttu-id="97512-229">**不可複寫**</span><span class="sxs-lookup"><span data-stu-id="97512-229">**Not For Replication**</span></span>|<span data-ttu-id="97512-230">**int**</span><span class="sxs-lookup"><span data-stu-id="97512-230">**int**</span></span>|<span data-ttu-id="97512-231">識別屬性不會強制執行時複寫的登入,例如**sqlrepl**,將資料插入至資料表:</span><span class="sxs-lookup"><span data-stu-id="97512-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="97512-232">1 = True</span><span class="sxs-lookup"><span data-stu-id="97512-232">1 = True</span></span><br /><br /> <span data-ttu-id="97512-233">0 = False</span><span class="sxs-lookup"><span data-stu-id="97512-233">0 = False</span></span>|  

-   <span data-ttu-id="97512-234">在資料行上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-234">Additional result set returned on columns:</span></span>  

    |<span data-ttu-id="97512-235">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-235">Column name</span></span>|<span data-ttu-id="97512-236">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-236">Data type</span></span>|<span data-ttu-id="97512-237">描述</span><span class="sxs-lookup"><span data-stu-id="97512-237">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-238">**RowGuidCol**</span><span class="sxs-lookup"><span data-stu-id="97512-238">**RowGuidCol**</span></span>|<span data-ttu-id="97512-239">**sysname**</span><span class="sxs-lookup"><span data-stu-id="97512-239">**sysname**</span></span>|<span data-ttu-id="97512-240">全域唯一識別碼資料行的名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-240">Name of the global unique identifier column.</span></span>|  

-   <span data-ttu-id="97512-241">在檔案群組上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-241">Additional result set returned on filegroups:</span></span>  

    |<span data-ttu-id="97512-242">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-242">Column name</span></span>|<span data-ttu-id="97512-243">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-243">Data type</span></span>|<span data-ttu-id="97512-244">描述</span><span class="sxs-lookup"><span data-stu-id="97512-244">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-245">**Data_located_on_filegroup**</span><span class="sxs-lookup"><span data-stu-id="97512-245">**Data_located_on_filegroup**</span></span>|<span data-ttu-id="97512-246">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-246">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-247">資料位於檔案群組:主要、 次要 」 或 「 交易記錄檔。</span><span class="sxs-lookup"><span data-stu-id="97512-247">Filegroup in which the data is located: Primary, Secondary, or Transaction Log.</span></span>|  

-   <span data-ttu-id="97512-248">在索引上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-248">Additional result set returned on indexes:</span></span>  

    |<span data-ttu-id="97512-249">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-249">Column name</span></span>|<span data-ttu-id="97512-250">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-250">Data type</span></span>|<span data-ttu-id="97512-251">描述</span><span class="sxs-lookup"><span data-stu-id="97512-251">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-252">**index_name**</span><span class="sxs-lookup"><span data-stu-id="97512-252">**index_name**</span></span>|<span data-ttu-id="97512-253">**sysname**</span><span class="sxs-lookup"><span data-stu-id="97512-253">**sysname**</span></span>|<span data-ttu-id="97512-254">索引名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-254">Index name.</span></span>|  
    |<span data-ttu-id="97512-255">**Index_description**</span><span class="sxs-lookup"><span data-stu-id="97512-255">**Index_description**</span></span>|<span data-ttu-id="97512-256">**varchar(** 210 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-256">**varchar(** 210 **)**</span></span>|<span data-ttu-id="97512-257">索引的描述。</span><span class="sxs-lookup"><span data-stu-id="97512-257">Description of the index.</span></span>|  
    |<span data-ttu-id="97512-258">**index_keys**</span><span class="sxs-lookup"><span data-stu-id="97512-258">**index_keys**</span></span>|<span data-ttu-id="97512-259">**nvarchar(** 2078 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-259">**nvarchar(** 2078 **)**</span></span>|<span data-ttu-id="97512-260">建立索引的資料行名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-260">Column names on which the index is built.</span></span> <span data-ttu-id="97512-261">如果是 xVelocity 記憶體最佳化的資料行存放區索引,則傳回 NULL。</span><span class="sxs-lookup"><span data-stu-id="97512-261">Returns NULL for xVelocity memory optimized columnstore indexes.</span></span>|  

-   <span data-ttu-id="97512-262">在條件約束上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-262">Additional result set returned on constraints:</span></span>  

    |<span data-ttu-id="97512-263">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-263">Column name</span></span>|<span data-ttu-id="97512-264">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-264">Data type</span></span>|<span data-ttu-id="97512-265">描述</span><span class="sxs-lookup"><span data-stu-id="97512-265">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-266">**constraint_type**</span><span class="sxs-lookup"><span data-stu-id="97512-266">**constraint_type**</span></span>|<span data-ttu-id="97512-267">**nvarchar(** 146 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-267">**nvarchar(** 146 **)**</span></span>|<span data-ttu-id="97512-268">條件約束的類型。</span><span class="sxs-lookup"><span data-stu-id="97512-268">Type of constraint.</span></span>|  
    |<span data-ttu-id="97512-269">**constraint_name**</span><span class="sxs-lookup"><span data-stu-id="97512-269">**constraint_name**</span></span>|<span data-ttu-id="97512-270">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-270">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-271">條件約束的名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-271">Name of the constraint.</span></span>|  
    |<span data-ttu-id="97512-272">**delete_action**</span><span class="sxs-lookup"><span data-stu-id="97512-272">**delete_action**</span></span>|<span data-ttu-id="97512-273">**nvarchar(** 9 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-273">**nvarchar(** 9 **)**</span></span>|<span data-ttu-id="97512-274">指出 DELETE 動作是:NO_ACTION、 CASCADE、 SET_NULL、 SET_DEFAULT 或 n/A。</span><span class="sxs-lookup"><span data-stu-id="97512-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="97512-275">只適用於 FOREIGN KEY 條件約束。</span><span class="sxs-lookup"><span data-stu-id="97512-275">Only applicable to FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="97512-276">**update_action**</span><span class="sxs-lookup"><span data-stu-id="97512-276">**update_action**</span></span>|<span data-ttu-id="97512-277">**nvarchar(** 9 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-277">**nvarchar(** 9 **)**</span></span>|<span data-ttu-id="97512-278">指出 UPDATE 動作是:NO_ACTION、 CASCADE、 SET_NULL、 SET_DEFAULT 或 n/A。</span><span class="sxs-lookup"><span data-stu-id="97512-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="97512-279">只適用於 FOREIGN KEY 條件約束。</span><span class="sxs-lookup"><span data-stu-id="97512-279">Only applicable to FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="97512-280">**status_enabled**</span><span class="sxs-lookup"><span data-stu-id="97512-280">**status_enabled**</span></span>|<span data-ttu-id="97512-281">**varchar(** 8 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-281">**varchar(** 8 **)**</span></span>|<span data-ttu-id="97512-282">指出是否已啟用條件約束:啟用已停用或 n/A。</span><span class="sxs-lookup"><span data-stu-id="97512-282">Indicates whether the constraint is enabled: Enabled, Disabled, or N/A.</span></span><br /><br /> <span data-ttu-id="97512-283">只適用於 CHECK 和 FOREIGN KEY 條件約束。</span><span class="sxs-lookup"><span data-stu-id="97512-283">Only applicable to CHECK and FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="97512-284">**status_for_replication**</span><span class="sxs-lookup"><span data-stu-id="97512-284">**status_for_replication**</span></span>|<span data-ttu-id="97512-285">**varchar(** 19 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-285">**varchar(** 19 **)**</span></span>|<span data-ttu-id="97512-286">指出條件約束是否針對複寫。</span><span class="sxs-lookup"><span data-stu-id="97512-286">Indicates whether the constraint is for replication.</span></span><br /><br /> <span data-ttu-id="97512-287">只適用於 CHECK 和 FOREIGN KEY 條件約束。</span><span class="sxs-lookup"><span data-stu-id="97512-287">Only applicable to CHECK and FOREIGN KEY constraints.</span></span>|  
    |<span data-ttu-id="97512-288">**constraint_keys**</span><span class="sxs-lookup"><span data-stu-id="97512-288">**constraint_keys**</span></span>|<span data-ttu-id="97512-289">**nvarchar(** 2078 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-289">**nvarchar(** 2078 **)**</span></span>|<span data-ttu-id="97512-290">組成條件約束的資料行名稱,如果是預設值和規則,便是定義預設值或規則的文字。</span><span class="sxs-lookup"><span data-stu-id="97512-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="97512-291">在進行參考的物件上傳回的其他結果集:</span><span class="sxs-lookup"><span data-stu-id="97512-291">Additional result set returned on referencing objects:</span></span>  

    |<span data-ttu-id="97512-292">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-292">Column name</span></span>|<span data-ttu-id="97512-293">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-293">Data type</span></span>|<span data-ttu-id="97512-294">描述</span><span class="sxs-lookup"><span data-stu-id="97512-294">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-295">**資料表的參考者**</span><span class="sxs-lookup"><span data-stu-id="97512-295">**Table is referenced by**</span></span>|<span data-ttu-id="97512-296">**nvarchar(** 516 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-296">**nvarchar(** 516 **)**</span></span>|<span data-ttu-id="97512-297">識別參考資料表的其他資料庫物件。</span><span class="sxs-lookup"><span data-stu-id="97512-297">Identifies other database objects that reference the table.</span></span>|  

-   <span data-ttu-id="97512-298">在預存程序、函數或擴充預存程序上傳回的其他結果集。</span><span class="sxs-lookup"><span data-stu-id="97512-298">Additional result set returned on stored procedures, functions, or extended stored procedures.</span></span>  

    |<span data-ttu-id="97512-299">資料行名稱</span><span class="sxs-lookup"><span data-stu-id="97512-299">Column name</span></span>|<span data-ttu-id="97512-300">資料類型</span><span class="sxs-lookup"><span data-stu-id="97512-300">Data type</span></span>|<span data-ttu-id="97512-301">描述</span><span class="sxs-lookup"><span data-stu-id="97512-301">Description</span></span>|  
    |-----------------|---------------|-----------------|  
    |<span data-ttu-id="97512-302">**Parameter_name**</span><span class="sxs-lookup"><span data-stu-id="97512-302">**Parameter_name**</span></span>|<span data-ttu-id="97512-303">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-303">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-304">預存程序參數名稱。</span><span class="sxs-lookup"><span data-stu-id="97512-304">Stored procedure parameter name.</span></span>|  
    |<span data-ttu-id="97512-305">**型別**</span><span class="sxs-lookup"><span data-stu-id="97512-305">**Type**</span></span>|<span data-ttu-id="97512-306">**nvarchar(** 128 **)**</span><span class="sxs-lookup"><span data-stu-id="97512-306">**nvarchar(** 128 **)**</span></span>|<span data-ttu-id="97512-307">預存程序參數的資料類型。</span><span class="sxs-lookup"><span data-stu-id="97512-307">Data type of the stored procedure parameter.</span></span>|  
    |<span data-ttu-id="97512-308">**長度**</span><span class="sxs-lookup"><span data-stu-id="97512-308">**Length**</span></span>|<span data-ttu-id="97512-309">**smallint**</span><span class="sxs-lookup"><span data-stu-id="97512-309">**smallint**</span></span>|<span data-ttu-id="97512-310">最大的實體儲存體長度 (以位元組為單位)。</span><span class="sxs-lookup"><span data-stu-id="97512-310">Maximum physical storage length, in bytes.</span></span>|  
    |<span data-ttu-id="97512-311">**prec**</span><span class="sxs-lookup"><span data-stu-id="97512-311">**Prec**</span></span>|<span data-ttu-id="97512-312">**int**</span><span class="sxs-lookup"><span data-stu-id="97512-312">**int**</span></span>|<span data-ttu-id="97512-313">有效位數或總位數。</span><span class="sxs-lookup"><span data-stu-id="97512-313">Precision or total number of digits.</span></span>|  
    |<span data-ttu-id="97512-314">**小數位數**</span><span class="sxs-lookup"><span data-stu-id="97512-314">**Scale**</span></span>|<span data-ttu-id="97512-315">**int**</span><span class="sxs-lookup"><span data-stu-id="97512-315">**int**</span></span>|<span data-ttu-id="97512-316">小數點右側的位數。</span><span class="sxs-lookup"><span data-stu-id="97512-316">Number of digits to the right of the decimal point.</span></span>|  
    |<span data-ttu-id="97512-317">**Param_order**</span><span class="sxs-lookup"><span data-stu-id="97512-317">**Param_order**</span></span>|<span data-ttu-id="97512-318">**smallint**</span><span class="sxs-lookup"><span data-stu-id="97512-318">**smallint**</span></span>|<span data-ttu-id="97512-319">參數的順序。</span><span class="sxs-lookup"><span data-stu-id="97512-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.

PermissionsPermissions

需要 public 角色的成員資格。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

Database Engine 預存程序(Transact SQL) Database Engine Stored Procedures (Transact-SQL)
sp_helpindex (-SQL&#41;) 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 (-SQL&#41;) sp_helpuser (Transact-SQL)
系統預存程序 (Transact-SQL) System Stored Procedures (Transact-SQL)
sys.sysobjects (Transact-SQL)sys.sysobjects (Transact-SQL)