zoukankan      html  css  js  c++  java
  • 将xml导入数据库 IT

    xml 字符串

    DECLARE @idoc int
    DECLARE @doc xml
    SELECT @doc= N'<shopcats_list_get_response><shop_cats list="true"><shop_cat><cid>13</cid><is_parent>false</is_parent><name>手机</name><parent_cid>0</parent_cid></shop_cat><shop_cat><cid>1154</cid><is_parent>false</is_parent><name>服饰配件/皮带/帽子/围巾</name><parent_cid>0</parent_cid></shop_cat></shop_cats></shopcats_list_get_response>'
    EXEC sp_xml_preparedocument @Idoc OUTPUT, @doc
    SELECT * into #temp FROM OPENXML (@Idoc'/shopcats_list_get_response/shop_cats/shop_cat',2)
    WITH ([cid] bigint,[is_parent] bit,[name] nvarchar(10),[parent_cid] bigint)
    select * from #temp   

    xml 文件  ,在将定义@doc的格式该成从文件加载(未测试)

    SELECT @doc=bulkcolumn FROM OPENROWSET(
      
    BULK ’D: test.xml’,
      SINGLE_BLOB) 
    AS x 

  • 相关阅读:
    HTML-代码定义
    数组
    for。。。for嵌套if,if嵌套for。
    输入年月日, 判断输入的是否正确
    日期功能
    方程
    5.8 一维数组
    5.9 二维数组
    5.7 类
    5.4穷举,迭代
  • 原文地址:https://www.cnblogs.com/machaofast/p/2082929.html
Copyright © 2011-2022 走看看