zoukankan      html  css  js  c++  java
  • sqlser生成guid与复制造数

    NEWID()可以生成GUID,如果要小写,则LOWER(NEWID())

    可生成 2144400c-322c-4673-b24c-6a29db94422c 类似这样的

    采用如下方法可复制造数,非常快:

    INSERT INTO 表名(字段名)

    SELECT 字段名  --可用函数替换要更改的字段

    FROM 表名 条件

    例子:

    INSERT INTO SimMonthBillItem ([ID], [BusinessID], [BillID], [SubjectId], [DueAmount], [UpdateTime], [CreateTime]) 
    select LOWER(NEWID()), [BusinessID], LOWER(NEWID()), [SubjectId], [DueAmount], [UpdateTime], [CreateTime]
    from SimMonthBillItem where businessid <> 18751388
    
    INSERT INTO SimMonthBill ([ID], [BusinessID], [BillID], [BillType], [BillIndex], [BillMonth], [MonthAmount], [BeginTime], [EndTime], [UpdateTime], [CreateTime]) 
    select LOWER(NEWID()), [BusinessID], LOWER(NEWID()), [BillType], [BillIndex], [BillMonth], [MonthAmount], [BeginTime], [EndTime], [UpdateTime], [CreateTime]
    from SimMonthBill where businessid <> 18751388
    
    INSERT INTO Received ([BillID], [BillItemID], [Amount], [ReceivedType], [PayID], [ReceivedTime], [CreateTime], [OperatorID], [Explain], [DeductionID], [ToAccountID], [ToAcountTime], [OAApplyCode], [IsAfterClear]) 
    select [BillID], [BillItemID], [Amount], [ReceivedType], [PayID], [ReceivedTime], [CreateTime], [OperatorID], [Explain], [DeductionID], [ToAccountID], [ToAcountTime], [OAApplyCode], [IsAfterClear]
    from Received where billid not in (83636374,83636376)
  • 相关阅读:
    深度优先遍历
    从零开始学习Sencha Touch MVC应用之三
    从零开始学习Sencha Touch MVC应用之二
    开始 Sencha Touch 2 之旅之一
    开始 Sencha Touch 2 之旅之三
    从零开始学习Sencha Touch MVC应用之一
    开始 Sencha Touch 2 之旅之二
    开始 Sencha Touch 2 之旅之四
    phonegap一些事件
    ubuntu 10.10安装nginx+php的过程
  • 原文地址:https://www.cnblogs.com/carlvine/p/12893089.html
Copyright © 2011-2022 走看看