XML数据类型在数据库中的应用
以下是资料介绍,如需要完整的请充值下载. 本资料已审核过,确保内容和网页里介绍一致. 密 惠
无需注册登录,支付后按照提示操作即可获取该资料.
无需注册登录,支付后按照提示操作即可获取该资料.
资料介绍:
XML数据类型在数据库中的应用
SQL SERVER 2005 介绍一个新的数量数据类型,XML的数据类型。 XML现在是 SQL SERVER的一个最新的数据类型,而且这有在XML的使用上的一种大范围的冲击。
XML数据类型
XML是近几年来很受欢迎的新的数据类型。XML对一个包括它自己的数据定义的字汇, XSD 连同疑问语言的数据模型已经从一笔简单的数据进展移动格式。 在这章中,我们将会看XML数据类型而且见到它如何不同于传统的 CLOB(个性大的物体领域,收回本文领域 SQL SERVER) 一份XML文件的储藏。
你能像 SQL SERVER的任何其他的数据类型一样使用XML数据类型。 可以用下列的方式使用:
如一个表的专栏
当一个变量之时在办理SQL(T-SQL)
如一个被储存的程序或使用者定义的功能参数
如一个使用者定义的功能回返价值
XML类型相当相似, 但是不是同样的,被 SQL 定义的独特类型:1999 和在第 1 章中讨论过。 虽然XML语言被写成连载长篇而刊登的形式是相似的在外表中到 CLOB(VARCHAR(最大)), 但是你来回地转换它一个 VARCHAR 类型, 不愿分配它。 相似的清楚类型,XML数据类型能够没有被投或转换一点也不被与其他的数据比较类型, 但是不像清楚的类型, 一个数据类型不能够被比较的XML的二个例证。
比如一个 SQL:1999的类型,XML语言类型有它自己的方法; 这些方法使其它可能的疑问使用语言, XQuery 。 一个XML语言类型的数据不跟随表示关系的数据模型但是以一个广大的XML Infoset 模型为基础, 用来做模型 structuredthat 是hierarchicaldata。
XML in the Database: The XML Data Type
SQL SERVER 2005 introduces a new scalar data type, the XML data type. XML is a first-class data type in SQL Server now, and this has a wide-ranging impact on the use of XML.
The XML Data Type
A new type of data has gained popularity in recent years: XML. XML has evolved from a simple data transfer format to a data model that includes its own schema-definition vocabulary, XSD, as well as query languages. In this chapter, we'll look at the XML data type and see how it differs from conventional CLOB (character large object field, called TEXT field in SQL Server) storage of an XML document.
You can use the XML data type like any other data type in SQL Server. It can be used in the following ways:
• As a column in a table
• As a variable in Transact-SQL (T-SQL)
• As a stored procedure or user-defined function parameter
• As a user-defined function return value
The XML type is quite similar, but not identical, to the distinct type defined by SQL:1999 and discussed in Chapter 1. Although the serialized form of XML is similar in appearance to a CLOB (VARCHAR(MAX)), you convert it to and from a VARCHAR type, rather than assign it. Like distinct types, the XML data type cannot be compared with other data types without being cast or converted, but unlike distinct types, two instances of an XML data type cannot be compared at all.
Like a SQL:1999 distinct type, the XML type has its own methods; these methods enable the use of an alternative query language, XQuery. The data in an XML type does not follow the relational data model but is based on an extended XML Infoset model, which is used to model structuredthat is, hierarchicaldata.
A column that is defined as being of type XML stores its data in the database itself. The column is not a pointer to an XML document on the file system. This means that XML data is included in the backup and restore process; is subject to ordinary SQL Server security (and some extensions to security, as we'll mention later); and participates in transactions, constraints, and logging. Having XML data inside a relational database may offend some relational purists, but it means that your data lives in a single repository for reasons of administration, reliability, and control.
Using XML Data Type in Tables
Let's begin by using the XML data type to define a column in a table. The following DDL statement
SQL SERVER 2005 介绍一个新的数量数据类型,XML的数据类型。 XML现在是 SQL SERVER的一个最新的数据类型,而且这有在XML的使用上的一种大范围的冲击。
XML数据类型
XML是近几年来很受欢迎的新的数据类型。XML对一个包括它自己的数据定义的字汇, XSD 连同疑问语言的数据模型已经从一笔简单的数据进展移动格式。 在这章中,我们将会看XML数据类型而且见到它如何不同于传统的 CLOB(个性大的物体领域,收回本文领域 SQL SERVER) 一份XML文件的储藏。
你能像 SQL SERVER的任何其他的数据类型一样使用XML数据类型。 可以用下列的方式使用:
如一个表的专栏
当一个变量之时在办理SQL(T-SQL)
如一个被储存的程序或使用者定义的功能参数
如一个使用者定义的功能回返价值
XML类型相当相似, 但是不是同样的,被 SQL 定义的独特类型:1999 和在第 1 章中讨论过。 虽然XML语言被写成连载长篇而刊登的形式是相似的在外表中到 CLOB(VARCHAR(最大)), 但是你来回地转换它一个 VARCHAR 类型, 不愿分配它。 相似的清楚类型,XML数据类型能够没有被投或转换一点也不被与其他的数据比较类型, 但是不像清楚的类型, 一个数据类型不能够被比较的XML的二个例证。
比如一个 SQL:1999的类型,XML语言类型有它自己的方法; 这些方法使其它可能的疑问使用语言, XQuery 。 一个XML语言类型的数据不跟随表示关系的数据模型但是以一个广大的XML Infoset 模型为基础, 用来做模型 structuredthat 是hierarchicaldata。
XML in the Database: The XML Data Type
SQL SERVER 2005 introduces a new scalar data type, the XML data type. XML is a first-class data type in SQL Server now, and this has a wide-ranging impact on the use of XML.
The XML Data Type
A new type of data has gained popularity in recent years: XML. XML has evolved from a simple data transfer format to a data model that includes its own schema-definition vocabulary, XSD, as well as query languages. In this chapter, we'll look at the XML data type and see how it differs from conventional CLOB (character large object field, called TEXT field in SQL Server) storage of an XML document.
You can use the XML data type like any other data type in SQL Server. It can be used in the following ways:
• As a column in a table
• As a variable in Transact-SQL (T-SQL)
• As a stored procedure or user-defined function parameter
• As a user-defined function return value
The XML type is quite similar, but not identical, to the distinct type defined by SQL:1999 and discussed in Chapter 1. Although the serialized form of XML is similar in appearance to a CLOB (VARCHAR(MAX)), you convert it to and from a VARCHAR type, rather than assign it. Like distinct types, the XML data type cannot be compared with other data types without being cast or converted, but unlike distinct types, two instances of an XML data type cannot be compared at all.
Like a SQL:1999 distinct type, the XML type has its own methods; these methods enable the use of an alternative query language, XQuery. The data in an XML type does not follow the relational data model but is based on an extended XML Infoset model, which is used to model structuredthat is, hierarchicaldata.
A column that is defined as being of type XML stores its data in the database itself. The column is not a pointer to an XML document on the file system. This means that XML data is included in the backup and restore process; is subject to ordinary SQL Server security (and some extensions to security, as we'll mention later); and participates in transactions, constraints, and logging. Having XML data inside a relational database may offend some relational purists, but it means that your data lives in a single repository for reasons of administration, reliability, and control.
Using XML Data Type in Tables
Let's begin by using the XML data type to define a column in a table. The following DDL statement