带有多个Insert语句的SQL Compact Error 80040E14

时间:2016-03-07 13:28:46

标签: sql sql-server-ce

我正在尝试使用SQL Lite Toolbox for Visual Studio 2015在SQL Compact DB上执行此查询。

INSERT INTO [RadiatorRegistries] ([Brand], [Series], [Model], [Height], [Width], [Depth], [Whellbase], [Capacity], [Surface], [Q50], [Exp], [Typology], [Material], [Kc1], [Kc2], [KcR]) VALUES (N'Aermec', N'Climafon', N'33', 675, 1000, 140, 0, CAST(0.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2)), 2001, CAST(1.30 AS Decimal(18, 2)), N'Termoconvettore', N'Alluminio', CAST(1.00 AS Decimal(18, 2)), CAST(1.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2)))
INSERT INTO [RadiatorRegistries] ([Brand], [Series], [Model], [Height], [Width], [Depth], [Whellbase], [Capacity], [Surface], [Q50], [Exp], [Typology], [Material], [Kc1], [Kc2], [KcR]) VALUES (N'Aermec', N'Climafon', N'41', 675, 1200, 140, 0, CAST(0.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2)), 1810, CAST(1.30 AS Decimal(18, 2)), N'Termoconvettore', N'Alluminio', CAST(1.00 AS Decimal(18, 2)), CAST(1.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2)))

返回的错误是:

[ Token line number = 2,Token line offset = 1,Token in error = INSERT ]
Error Code: 80040E14

如果我删除第二行INSERT工作正常,问题是我要插入大约2500行,我无法手动执行此操作。我也已经尝试在每一行的末尾添加一个分号。

有什么建议吗?

2 个答案:

答案 0 :(得分:1)

用GO:

分隔每一行
INSERT INTO [RadiatorRegistries] ([Brand],
GO
INSERT INTO [RadiatorRegistries] ([Brand],
GO

答案 1 :(得分:0)

一种方法是将insert . . . selectunion all

一起使用
INSERT INTO [RadiatorRegistries]([Brand], [Series], [Model], [Height], [Width], [Depth], [Whellbase], [Capacity], [Surface], [Q50], [Exp], [Typology], [Material], [Kc1], [Kc2], [KcR]) 
    SELECT N'Aermec', N'Climafon', N'33', 675, 1000, 140, 0, CAST(0.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2)), 2001, CAST(1.30 AS Decimal(18, 2)), N'Termoconvettore', N'Alluminio', CAST(1.00 AS Decimal(18, 2)), CAST(1.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2))
    UNION ALL
    SELECT N'Aermec', N'Climafon', N'41', 675, 1200, 140, 0, CAST(0.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2)), 1810, CAST(1.30 AS Decimal(18, 2)), N'Termoconvettore', N'Alluminio', CAST(1.00 AS Decimal(18, 2)), CAST(1.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(18, 2))