SQL Compact - 执行多个插入语句时出错
我正在使用 Management Studio 连接到我的 sql mobile/compact 数据库。
我试图将一些虚拟数据插入到某些表中,例如:
INSERT INTO FlooringTypes (FlooringType) VALUES ('Carpet')
INSERT INTO FlooringTypes (FlooringType) VALUES ('Smooth')
但是它返回错误:
主要错误 0x80040E14,次要错误 25501
如果我单独运行它们,它工作正常。
I'm using management studio to connect to my sql mobile/compact database.
I'm trying to insert some dummy data into some tables, for example:
INSERT INTO FlooringTypes (FlooringType) VALUES ('Carpet')
INSERT INTO FlooringTypes (FlooringType) VALUES ('Smooth')
However it returns the error:
Major Error 0x80040E14, Minor Error 25501
If I run them seperately it works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
把 GO 放在他们之间。我认为 SQL CE 不处理批处理。
Put GO between them. I think SQL CE doesn't handle batches.
第一个方法是在每行后添加分号(不包括最后一行)。
The first will work by adding a semi colon after each line (excluding the last line).
您还可以考虑使用单个语句,并用逗号分隔各个值。这适用于常规 SQL Server。我不确定它是否也适用于 Compact,因为我没有安装它,但我认为没有理由不这样做:
You could also consider using one single statement, and seperating the individual values with commas. This works in regular SQL Server. I'm not sure if it also works on Compact, as I don't have that installed, but I see no reason why it shouldn't:
使用逗号来解决上述错误
INSERT INTO FlooringTypes (FlooringType) VALUES ('Carpet');
INSERT INTO FlooringTypes (FlooringType) VALUES ('Smooth')
USE COMMA THAT IS A SOLUTION FOR ABOVE ERROR
INSERT INTO FlooringTypes (FlooringType) VALUES ('Carpet');
INSERT INTO FlooringTypes (FlooringType) VALUES ('Smooth')