1. Trang chủ
  2. » Công Nghệ Thông Tin

The Real MTCS SQL Server 2008 Exam 70/432 Prep Kit- P106 ppsx

5 89 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 129 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Figure 11.24 shows an example of the XPath number function.. ' -- Create a new table declare @XMLTable table pk INT IDENTITY PRIMARY KEY, colxml XML --Insert data into the new table INSE

Trang 1

Now we will switch to showing basic examples of using the numeric and string

functions

Figure 11.24 shows an example of the XPath number function This function

can be used to convert a nonnumeric value to a numeric value The result of this

example query would return the employee where the EmployeeID is a number

that is equal to 680

</item>

</product>'

Create a new table

declare @XMLTable table (pk INT IDENTITY PRIMARY KEY, colxml XML)

Insert data into the new table

INSERT INTO @XMLTable(colxml)

VALUES (@xmlData)

In Figure 11.22, you will use the XPath function, count, to count the number of

item nodes in your XML document

Figure 11.22 XPath Expression Count

Count the number of people

SELECT colxml.query(

'count(//item)

')

FROM @XMLTable

In Figure 11.23 you will use the XPath function, contains, to return the string

that contains the word “BaseBall Bats.”

Figure 11.23 XPath Expression Contains

SELECT *

FROM @XMLTable

WHERE

colxml.exist('/product/item/name[contains(.,"BaseBall Bats")]') = 1

Trang 2

Figure 11.24 XPath Expression Numeric

/Employee[number(@EmployeeID) = 680]

Figure 11.25 shows an example of the XPath string function This function can

be used to convert a non-string value to a string value The result of this example query would return the employee where the EmployeeID contains a string value that is equal to 680

These are just a few examples of all the XPath expressions that can be used You can refer to Table 11.10 Expression Types for XPath to find more

/Employee[string(@EmployeeID)="680"]

Figure 11.25 XPath Expression String

Trang 3

Summary of Exam Objectives

This chapter examined XML, XQuery, XPath, HTTP endpoints, and Web Services

You learned how to use XQuery to retrieve and modify data within an XML

data type

HTTP endpoints provide ways to allow developers to expose their code and

access it using their SOAP client You learned how to create an HTTP endpoint

with SQL Server 2008 as well as how to secure it

Lastly, we reviewed Web Services and how developers use Web Services to

present data to their clients Web Services uses XML as its base language so that all

programming languages, whether written in C++, VB.net, or C#, can communicate with it

Exam Objectives Fast Track

Working with XML Data

The first index on the XML type column must be the primary

˛

XML index

An XML index cannot be created on an XML type column in a view,

˛

table value variable with XML type columns, or XML type

The stored representation of XML data type instances cannot exceed 2

˛

gigabytes (GB) in size

HTTP Endpoints

Expose stored procedures and functions within a SQL Server 2008

˛

database

Support two protocols, HTTP and TCP

˛

Support payloads,

MIRRORING.

Use

˛ CREATE ENDPOINT to create an endpoint.

Not supported in SQL Server 2008 Express Edition

˛

Trang 4

Web Services

Web Services use XML as a base language and can be written in programming

˛

languages such as; C++, VB.NET, or C#

Web Services can be accessed by web platform elements such as SOAP,

˛

UDDI, and WSDI

Web Services enable programs written in different languages to

˛

communicate

XQuery Explained

XQuery is a language used to query XML documents

˛

XQuery uses four methods for querying: query( ), value( ), exist( ), and

˛

nodes( )

XQuery is case sensitive

˛

XQuery provides extensions for modifying XML, modify( )

˛

Three DML statements are used in conjunction with modify( ), INSERT,

˛

DELETE, and REPLACE VALUE OF

XPath

XPath is a query language used to identify a set of nodes in an XML

˛

document

XPath computes strings, numbers, or boolean values

˛

The four categories of XPath operators are Boolean, Relational, Equity,

˛

and Arithmetic

Trang 5

Exam Objectives

Frequently Asked Questions

Q: Can the clustered primary key of a table be changed if an XML index already

exists on a table?

A: No, all XML indexes must be dropped before a clustered primary key on a table can be modified

Q: Are SQL Server HTTP endpoints supported in all SQL Server 2008 versions?

A: No, HTTP endpoints are not supported in the SQL Server 2008 Express

edition

Q: Can a stored procedure be exposed for endpoint mapping?

A: Yes, database objects such as stored procedures and user-defined functions can

be exposed for endpoint mapping

Q: Is the XQuery language case sensitive?

A: Yes, it is important to remember that XQuery statements are case sensitive

when building queries

Q: Which methods are available for querying XML data with XQuery?

A: The query(), value( ), exist( ), and nodes( ) methods are available when using

XQuery

Q: What language is used to select a set of nodes from an XML document?

A: The Xpath language is used to select a set of nodes from an XML document

Ngày đăng: 07/07/2014, 00:20