在Access 2010中使用一个插入语句插入多行 [英] Insert multiple rows using one insert statement in Access 2010
问题描述
我想在Access 2010表中插入多个值,但似乎找不到方法.
MySQL有一个很好的方法:
I want to insert multiple values into an Access 2010 table, but I can't seem to find a way.
MySQL had a nice way:
INSERT INTO Production.UnitMeasure
VALUES
(N'FT2', N'Square Feet ', '20080923'),
(N'Y', N'Yards', '20080923'),
(N'Y3', N'Cubic Yards', '20080923');
这样的事情也可以在SQL Server中完成吗?
Can something like this be done in SQL Server too?
推荐答案
对于SQL Server:是的,它完全可以像您编写的那样.只需确定列值的顺序与表中显示的顺序相同即可.另外:您必须为每个现有列提供一个值.
For SQL-Server: Yes, and it can exactly like you write. Just be certain that the column values are in the same order as they appear in the table. Also: you must supply a value for each existing column.
对于Access 2010:否.至少不是通过sql中的硬编码值,而只能通过从表中选择多个记录(在同一数据库中或在另一个数据库中).另请参阅Khepri答案中的链接.
For Access 2010: No. At least not by hardcoded values in the sql, but only by selecting multiple records from a table (in the same or in another database). See also the link in the answer of Khepri.
这篇关于在Access 2010中使用一个插入语句插入多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!