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)

 

上一篇:信奥一本通 大整数加法(高精)


下一篇:工作158:vue里面为什么要加key