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

适用对象: 是SQL Server 是Azure SQL 数据库 是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。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。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。ID of the system type of the parameter.
user_type_iduser_type_id intint 用户定义的参数类型的 ID。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 架构命名空间的集合的 ID。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 = 参数不可为 Null。1 = Parameter is nullable. (默认值)。(the default).

0 = 参数不可为 Null,这样可更高效地执行本机编译存储过程。0 = Parameter is not nullable, for more efficient execution of natively-compiled stored procedures.

权限Permissions

目录视图中仅显示用户拥有的安全对象的元数据,或用户对其拥有某些权限的安全对象的元数据。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 (TRANSACT-SQL) sys.all_parameters (Transact-SQL)
sys.system_parameters (TRANSACT-SQL)sys.system_parameters (Transact-SQL)