[BTS] Use TSQL to query a XML field in SQLServer
2012-12-03 16:37
387 查看
When deploy BizTalk application. I often save XML message to database.
When display some field in XML, I need following SQL to query XML field.
starttime,
select
convert(xml,RequestXML).value('(//GENERALDATA/SERIAL_NO)[1]','varchar(30)') SERIAL_NO
from BizTalkTask
where interfaceid=10001
order by id desc
select
starttime,
convert(xml,RequestXML).query('//GENERALDATA/SERIAL_NO') XmlNode
from BizTalkTask
where interfaceid=10001
order by id desc
An anther sample:
<XmlColumn>.value('...namespace....; (...xPath...)[1]', 'Type') as ColumnAlias
Key : BizTalk Guideline 入门 教程
徐中
北京钛谷诚泽网络通讯科技有限公司
When display some field in XML, I need following SQL to query XML field.
starttime,
select
convert(xml,RequestXML).value('(//GENERALDATA/SERIAL_NO)[1]','varchar(30)') SERIAL_NO
from BizTalkTask
where interfaceid=10001
order by id desc
select
starttime,
convert(xml,RequestXML).query('//GENERALDATA/SERIAL_NO') XmlNode
from BizTalkTask
where interfaceid=10001
order by id desc
An anther sample:
SELECT x.requestpayload.value('declare namespace s="http://blah.ca/api"; (/s:validate-student-request/s:student-id)[1]', 'int') as studentidFROM xoutput x
<XmlColumn>.value('...namespace....; (...xPath...)[1]', 'Type') as ColumnAlias
Key : BizTalk Guideline 入门 教程
徐中
北京钛谷诚泽网络通讯科技有限公司
相关文章推荐
- HOW TO: Change the Owner of a User-Defined Data Type That Is in Use in SQL Server 2000
- How To Use Dynamic Sql in Sql Server ?
- How To Use Dynamic Sql in Sql Server ?
- 关于Generating user instances in SQL Server is disabled. Use sp_configure 'user instances enabled' to generate user instances的错误
- 插入mysql语句报错:1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
- sql server query to get the list of column name in a table
- Generating user instances in Sql Server is disabled. Use sp_configure 'user instances enabled' to generate user instances
- Top 10 steps to optimize data access in SQL Server: Part I (Use indexing)
- Top 10 steps to optimize data access in SQL Server: Part II (Re-factor TSQL and apply best practices)
- how to use danymic sql in SQL Server 2000
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- 关于Generating user instances in SQL Server is disabled. Use sp_configure 'user instances enabled' to generate user instances的错误
- MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- Server Error in '/' Application. Cannot use a leading .. to exit above the top directory
- Using the Index Server to create Query Page in asp.net
- How to Find All SQL Server Instance Running in Local Network c#
- Avoid to use "IN", "NOT IN" in SQL statement, try to use "LEFT JOIN" instead.
- LINQ to SQL 异常:SQL Server does not handle comparison of NText, Text, Xml, or Image data types
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version