--创建表 create TABLE test0122 ( id INT , num INT , CONSTRAINT chk_num CHECK ( num > 5 AND num < 30 )--添加约束5到30之间 ) INSERT INTO test0122 SELECT 1,14 UNION ALL SELECT 2,24 /* (2 row(s) affected) 插入上面2条成功 */INSERT INTO test0122 SELECT 4,1 /*插入失败 The INSERT statement conflicted with the CHECK constraint "chk_num". The conflict occurred in database "Maco", table "dbo.test0122", column 'num' */
我的想法是SQL SERVER有没有这种这样一种办法,让对同一张表的insert操作积累到一定程度后在执行实际的插入。
我在别的地方看到说sql server可以设置Maximum insert commit size, 不知道这是不是我想要的东西?
52 |0 |suspended|sa |ASTROB-MAP03|0 |MSSQL2005|INSERT|0 |
select * into B
from A
where .... -- 所有条件
--创建表
create TABLE test0122
(
id INT ,
num INT ,
CONSTRAINT chk_num CHECK ( num > 5
AND num < 30 )--添加约束5到30之间
)
INSERT INTO test0122
SELECT 1,14 UNION ALL
SELECT 2,24
/*
(2 row(s) affected)
插入上面2条成功
*/INSERT INTO test0122
SELECT 4,1
/*插入失败
The INSERT statement conflicted with the CHECK constraint "chk_num".
The conflict occurred in database "Maco", table "dbo.test0122", column 'num'
*/