Getting Started with SQL XML:--by jinjazz
1. xml: Ability to recognize elements, attributes, and values
2. XPath: addressing language, lookup similar to Windows directory (go to the wall if you don't use the dir command)
Syntax format, which can be combined as a condition:
"." Express oneself, "..." Said the father, "/" said the Son, "//" to indicate the offsprin
Copy CodeThe code is as follows:
/*01.
Introduction to 02.sql XML:
--by Jinjazz
--http://blog.csdn.net/jinjazz
25l
06.1, XML: Ability to recognize elements, attributes, and values
07.
08.2, XPath: Addressing language, lookup similar to Windows directory (go to the wall if you don't use the dir command)
09.
10. Syntax format, which can be combined as a condition:
Scenario 5 Using XML parametersChildren's shoes unfamiliar with SQL Server XML type parameters need to understand the concept of XQuery first, where XQuery is a language used to find and extract elements and attributes from XML documents, simply the language used to query
/*Isn't 'bcp' an internal or external command or a program that can be run?Check whether the bcp.exe file exists in C: Program FilesMicrosoft SQL server80toolsbinn.Check whether the directory C: Program FilesMicrosoft SQL Server80ToolsBinn is added to the path.Right-click my computer -- properties -- Advanced -- environment variables -- find path in system variab
Copy Code code as follows:
/*01.
Introduction to 02.sql XML:
--by Jinjazz
--http://blog.csdn.net/jinjazz
05.
06.1, XML: Ability to recognize elements, attributes, and values
07.
08.2, XPath: Addressing language, lookup similar to Windows directory (go to the wall if you don't use the dir command)
09.
10. Syntax format, which can be comb
/*
' bcp ' is not an internal or external command, nor is it a running program?
See if there's a bcp.exe file in C:Program filesmicrosoft SQL Server80toolsbinn.
Then look inside the path add C:Program filesmicrosoft SQL server80toolsbinn This directory does not.
Right--My computer--Properties--advanced--environment variables--Find path--edits in system variables
Copy codeThe Code is as follows:/* 01.02. SQL xml entry:03. -- by jinjazz04. -- http://blog.csdn.net/jinjazz05.06. 1. xml: Recognition of elements, attributes, and values07.. Xpath: Addressing language, similar to windows Directory Search (if you have never used the dir command, go to the wall)09.10. Syntax format. These syntaxes can be combined into conditions:1
SQL for xml query sample, xmlsample
Sample 1:
declare @x xml select @x='
select @x.query('/ArrayOfScheduledTime/ScheduledTime/RecurrenceType')/*
Select o. value ('recurrencetype [1] ', 'varchar (20)') 'recurrencetype 'from (select @ x 'X') t cross apply x. nodes ('/ArrayOfScheduledTime/ScheduledTime') x (o)/* Rec
After the previous article "jdom xml file operations" was published, many netizens responded well ~ However, it does not provide a single search and query function.Today, I would like to add.To query XML content, the traditional method is traversal. However, this original me
To generate an xml file based on the database query results, use thinkphp to generate the file. first, declare a header for xml, and then generate the desired node .. attention should be paid to encoding, and the node should be closed ., I didn't think it was so complicated
Demand:A table is an app table with the following structure: App_category The Category Id,xml field type to which the game belongsAnother table is the category table, which corresponds to the name of the ID, which is not.There is also a table for each game download record, the structure is as follows: Downlogs_appid for the corresponding gameThen the demand comes, to query the game's download record, the
How to generate an xml file based on the database query results and use thinkphp to generate this? solution ------------------ declare a header for xml and generate the desired node .. attention should be paid to encoding, and the node should be closed. ------ solution -------------------- when I did not think about th
SQL Federated Query and XML parsing instance
Here is an example of how to implement this feature:
(select A.ebillno, A.empname, A.applydate, B.hs_name, replace (A.summary,char (), '), char (), ') as SUMMARY, Cast (C.xmldata as XML). Value (' (/list/item/no/text ()) [1] ', ' NVARCHAR ') as No, cast (C.xmldata as
To generate an XML file based on the results of a database query, use thinkphp to generate
How does this work?
------Solution--------------------
The first is to declare a header as XML
The next is the node that corresponds to the build you want.
Attention needs to be paid to coding, and node closure.
------Solution-
Tags: detail href replacement symbol ATI tar MyBatis BSP bodyBecause this is an XML file that does not allow characters like ">" to appear Use the escape character to replace > and XML escape character
Field
symbols
Description
Less than sign
GT;
>
Greater than sign
Label:gt; =#{startdate} =#{enddate}Three date fields are stored in the database are strings, not date type, XML >,One thing, although it is a string but does not need to be converted to ASCII value to compare size, I previously used ASCII (CreateDate) and ASCII (#{startdate}) to compare, does not work.However, two strings can be compared directly to the size of the greater than and less than. Do not know the date format can be directly compared, try l
file is displayed.
(7) OK-complete
(8) At this time, the entire XML file is imported to access. The following shows that a table has been imported in the view.
(9) Now we can verify whether the data is complete. The access empty database we created is stored in C: \ db1.mdb. The following query statement can be use
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.