2016-03-07 57 views
0

我试图执行上的SQL精简DB与SQL精简版工具箱此查询为Visual Studio 2015年SQL紧凑错误80040E14多个Insert语句

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行,我不能手动做到这一点。我也已经尝试在每行的末尾添加一个分号。

有什么建议吗?

+0

尝试把一个分号每条语句的结束。 –

+0

@戈登林诺夫已经尝试过了。同样的错误。 –

回答

1

单独用GO每一行:

INSERT INTO [RadiatorRegistries] ([Brand], 
GO 
INSERT INTO [RadiatorRegistries] ([Brand], 
GO 
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))