• sqlserver 同时查询大批量数据的方法


     sqlserver 查询根据索引字段查询记录时,如果要查询的记录非常多,需要将要查询的值转为xml,并导入临时表中进行查询。

    写法:1

    DECLARE @XMLDocument XML  
    SET @XMLDocument='<Root>
    <Row><A>898989898</A><B>123213</B></Row>
    <Row><A>898989897</A><B>123212</B></Row>
    </Root>'
    SELECT  
    T.c.value('(B[1])', 'int') AS Id,
    T.c.value('(A[1])', 'varchar(20)') AS Id_No
    INTO #temp
    FROM    @XMLDocument.nodes('/Root/Row') AS T ( c );
    
    SELECT * FROM #temp;
    DROP TABLE #temp;

    写法:2

    DECLARE @XMLDocument XML  
    SET @XMLDocument='<Root>
    <Row id="173528" />
    <Row id="173527" />
    </Root>'
    SELECT  
    T.c.value('@id', 'int') AS id 
    INTO #temp
    FROM  @XMLDocument.nodes('/Root/Row') AS T ( c );
    
    SELECT * FROM #temp;
    DROP TABLE #temp;
  • 相关阅读:
    线程queue
    定时器
    event模拟数据库链接
    最速下降法(梯度下降法)
    神经网络中的反向传播算法
    批量学习和在线学习的区别
    LMS算法
    粒子群算法
    遗传算法
    logistic回归
  • 原文地址:https://www.cnblogs.com/ariter/p/14186045.html
Copyright © 2020-2023  润新知