sys.parameters (Transact-SQL)sys.parameters (Transact-SQL)

適用於: 是SQL Server 是Azure SQL Database 是Azure Synapse Analytics (SQL DW) 是平行處理資料倉儲 APPLIES TO: yesSQL Server yesAzure SQL Database yesAzure Synapse Analytics (SQL DW) yesParallel Data Warehouse

針對接受參數之物件的每個參數,各包含一個資料列。Contains a row for each parameter of an object that accepts parameters. 如果物件是純量函數,也會有一個描述傳回值的單一資料列。If the object is a scalar function, there is also a single row describing the return value. 這個資料列parameter_id值為 0。That row will have a parameter_id value of 0.

資料行名稱Column name 資料類型Data type 描述Description
object_idobject_id intint 這個參數所屬物件的識別碼。ID of the object to which this parameter belongs.
namename sysnamesysname 參數的名稱。Name of the parameter. 在物件中,這是唯一的。Is unique within the object.

如果物件是純量函數,參數名稱就是代表傳回值之資料列中的空字串。If the object is a scalar function, the parameter name is an empty string in the row representing the return value.
parameter_idparameter_id intint 參數的識別碼。ID of the parameter. 在物件中,這是唯一的。Is unique within the object.

如果物件是純量函數parameter_id = 0 就代表傳回的值。If the object is a scalar function, parameter_id = 0 represents the return value.
system_type_idsystem_type_id tinyinttinyint 參數系統類型的識別碼。ID of the system type of the parameter.
user_type_iduser_type_id intint 使用者所定義的參數類型識別碼。ID of the type of the parameter as defined by the user.

若要傳回之型別的名稱,加入sys.types目錄檢視這個資料行。To return the name of the type, join to the sys.types catalog view on this column.
max_lengthmax_length smallintsmallint 參數的最大長度 (以位元組為單位)。Maximum length of the parameter, in bytes.

值 =-1,當資料行資料類型是varchar (max)nvarchar (max)varbinary (max) ,或xmlValue = -1 when the column data type is varchar(max), nvarchar(max), varbinary(max), or xml.
有效位數precision tinyinttinyint 如果是以數值為基礎,便是參數的有效位數;否則,便是 0。Precision of the parameter if numeric-based; otherwise, 0.
scalescale tinyinttinyint 如果是以數值為基礎,便是參數的小數位數;否則,便是 0。Scale of the parameter if numeric-based; otherwise, 0.
is_outputis_output bitbit 1 = 參數是 OUTPUT 或 RETURN,否則就是 0。1 = Parameter is OUTPUT or RETURN; otherwise, 0.
is_cursor_refis_cursor_ref bitbit 1 = 參數是一個資料指標參考參數。1 = Parameter is a cursor-reference parameter.
has_default_valuehas_default_value bitbit 1 = 參數有預設值。1 = Parameter has default value.

SQL ServerSQL Server 只會在此目錄檢視中保留 CLR 物件的預設值;因此,對於 Transact-SQLTransact-SQL 物件,此資料行的值為 0。only maintains default values for CLR objects in this catalog view; therefore, this column has a value of 0 for Transact-SQLTransact-SQL objects. 若要檢視中的參數的預設值Transact-SQLTransact-SQL物件,請查詢定義資料行sys.sql_modules目錄檢視,或使用OBJECT_DEFINITION系統函數。To view the default value of a parameter in a Transact-SQLTransact-SQL object, query the definition column of the sys.sql_modules catalog view, or use the OBJECT_DEFINITION system function.
is_xml_documentis_xml_document bitbit 1 = 內容是完整的 XML 文件集。1 = Content is a complete XML document.

0 = 內容是文件片段,或者資料行的資料類型不是xml0 = Content is a document fragment, or the data type of the column is not xml.
default_valuedefault_value sql_variantsql_variant 如果has_default_value為 1,此資料行的值是參數的預設值的值; 否則為 NULL。If has_default_value is 1, the value of this column is the value of the default for the parameter; otherwise, NULL.
xml_collection_idxml_collection_id intint 非零參數的資料型別是否xml且 XML 具備類型。Non-zero if the data type of the parameter is xml and the XML is typed. 這個值是包含參數的驗證 XML 結構描述命名空間之集合的識別碼。The value is the ID of the collection containing the validating XML schema namespace of the parameter.

0 = 沒有 XML 結構描述集合。0 = No XML schema collection.
is_readonlyis_readonly bitbit 1 = 參數為 READONLY,否則就是 0。1 = Parameter is READONLY; otherwise, 0.
is_nullableis_nullable bitbit 1 = 參數不可為 Null1 = Parameter is nullable. (預設值)。(the default).

0 = 參數不可為 Null,適用於原生編譯預存程序更有效率的執行。0 = Parameter is not nullable, for more efficient execution of natively-compiled stored procedures.

PermissionsPermissions

目錄檢視內中繼資料的可見性會限制在使用者所擁有的安全性實體,或已授與使用者某些權限的安全性實體。The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. 如需相關資訊,請參閱 Metadata Visibility ConfigurationFor more information, see Metadata Visibility Configuration.

另請參閱See Also

物件目錄檢視 (Transact-SQL) Object Catalog Views (Transact-SQL)
目錄檢視 (Transact-SQL) Catalog Views (Transact-SQL)
查詢 SQL Server 系統目錄常見問題集 Querying the SQL Server System Catalog FAQ
sys.all_parameters (-SQL)) sys.all_parameters (Transact-SQL)
sys.system_parameters (-SQL))sys.system_parameters (Transact-SQL)