我共有 22025 条记录要从选择列表中插入。当我执行以下脚本时,错误提示“字符串或二进制数据将被截断”。而如果我在选择列表中添加一些 where 子句以减少一次插入的记录数,例如第一次插入 10000 条记录,第二次插入 12025 条记录,则没有错误提示。我检查了每个字段的长度,不超过目标列的长度。请指教。谢谢!
INSERT INTO [BWX]
SELECT PK1.STRING_VALUE,PK2.STRING_VALUE,PK3.STRING_VALUE,PK4.STRING_VALUE,
2000010, BW_ROW.ID AS BW_ROW_ID, BW_ROW.SEQUENCE_NUMBER,
0 AS UPDATE_FLAG, 0 AS DELETE_FLAG, BW_ROW.IS_ACTIVE
FROM BW_CELL AS PK1, BW_COLUMN AS PK1COL, BW_CELL AS PK2, BW_COLUMN AS PK2COL,
BW_CELL AS PK3, BW_COLUMN AS PK3COL, BW_CELL AS PK4, BW_COLUMN AS PK4COL,
BW_COLUMN AS PK9COL, BW_ROW
WHERE PK1.BW_ROW_ID = BW_ROW.ID AND PK1.PTN_KEY = 100
AND PK1.BW_COLUMN_ID = PK1COL.ID AND PK1COL.NAME = 'key_1'
AND PK2.BW_ROW_ID = BW_ROW.ID AND PK2.PTN_KEY = 100
AND PK2.BW_COLUMN_ID = PK2COL.ID AND PK2COL.NAME = 'key_2'
AND PK3.BW_ROW_ID = BW_ROW.ID AND PK3.PTN_KEY = 100
AND PK3.BW_COLUMN_ID = PK3COL.ID AND PK3COL.NAME = 'key_3'
AND PK4.BW_ROW_ID = BW_ROW.ID AND PK4.PTN_KEY = 100
AND PK4.BW_COLUMN_ID = PK4COL.ID AND PK4COL.NAME = 'key_4'
AND BW_ROW.BW_TBL_ID = 2000010 AND BW_ROW.IS_ACTIVE = 1 AND BW_ROW.TX_ID > -1
AND NOT EXISTS ( SELECT [BWX_ROW@DEVICE_FORECAST].BW_ROW_ID
FROM [BWX_ROW@DEVICE_FORECAST]
WHERE BW_ROW.ID = [BWX_ROW@DEVICE_FORECAST].BW_ROW_ID )