?й?T-SQL??10???????
???????????? ???????[ 2012/10/23 10:16:13 ] ????????
????5???????淶?????
????????????????+????????????????Customer_Update????????????????????????????????洢????????????????????????????洢?????ú??????????п?????????????????????????洢??????????????????????п????????淶???????????????????????UpdateCustomer??洢?????
????6??????????????????????????????????????CTE???????????????????????????
??????????????????SQL Server?????????????????????????????е?INSERT????????????????????????Ч????????????????1000????????????????????Ч????????????????
????????????????д??????δ?1000Ч?????????10??100?????棬??????????????????????????1.
????????1.????????????
CREATE TABLE dbo.TestInsert
(
Number INT PRIMARY KEY
);
--?????????????????????45??
DECLARE @index INT;
SET @index = 1;
WHILE @index <= 100000
BEGIN
INSERT dbo.TestInsert(Number) VALUES( @index);
SET @index = @index + 1;
END
--????????????????????????????????????1??
BEGIN TRAN
DECLARE @index INT;
SET @index = 1;
WHILE @index <= 100000
BEGIN
INSERT dbo.TestInsert(Number) VALUES( @index);
SET @index = @index + 1;
END
COMMIT
--????????10W?У????0??????????????100W?н??в???
INSERT dbo.TestInsert(Number)
SELECT TOP (100000) rn = ROW_NUMBER() OVER
(ORDER BY c1.[object_id])
FROM sys.columns AS c1
CROSS JOIN sys.columns AS c2
CROSS JOIN sys.columns AS c3
ORDER BY c1.[object_id];
--CTE????????????????????С?????????????????:
WITH cte AS(
SELECT TOP (100000) rn = ROW_NUMBER() OVER
(ORDER BY c1.[object_id])
FROM sys.columns AS c1
CROSS JOIN sys.columns AS c2
CROSS JOIN sys.columns AS c3
ORDER BY c1.[object_id]
)
INSERT dbo.TestInsert(Number) SELECT rn FROM cte
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11