打破沙锅--数据类型是xml

来源:互联网 发布:淘宝全网搜索热度 编辑:程序博客网 时间:2024/04/29 18:02

在MSsqlserver2005中,新增了数据类型是xml。
值得注意的是:
  对xml数据的查询语言有:
  第一、xmlcol.query('xpath表达式'),称它为xml查询语句。exam:select info.query('路径信息') from tablename where condition
  第二、xmlcol.modify('增删改语句'),称它为Xml Dml语句。
        ---增
         update Exams
         set info.modify('
         insert <a>fdd<a> as last into Exam[1]')
         where id=3//表示插入为xml文件第一个Exam元素的最后一个子元素
        ---删
         update Exams
         set info.modify('delete /exam[1]/a[5]')
         where id=3//表示删除第一个Exam元素的第五个a子元素
        ---改
         update Exams
         set info.modify('Replace Value Of xpathexp WITH value ')
         where id=3 //表示用特定值来替换path路径的值。   

原创粉丝点击