且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在SQL Server数据库单个表中插入多个记录.

更新时间:2023-02-07 09:23:11

您应该在单独的插入命令中编写它们.
You should write them in separate insert commands.
Insert into XYZ(a,b) Values ('x','y')
Insert into XYZ(a,b) Values ('x','y')
Insert into XYZ(a,b) Values ('x','y')
Insert into XYZ(a,b) Values ('x','y')




如果源数据位于表中,请使用insert into TARGETTABLE(FIELD1, FIELD2, ... ) select FIELD1, FIELD2, ... from SOURCETABLE 命令.


希望对您有所帮助.




And if source data is located in a table use insert into TARGETTABLE(FIELD1, FIELD2, ... ) select FIELD1, FIELD2, ... from SOURCETABLE command .


Hope it helps.


尝试以下链接:

http://msdn.microsoft.com/en-us/library/ms174335.aspx [ ^ ]
http ://blog.sqlauthority.com/2007/06/08/sql-server-insert-multiple-records-using-one-insert-statement-use-of-union-all/ [ ^ ]
Try the following link :

http://msdn.microsoft.com/en-us/library/ms174335.aspx[^]
http://blog.sqlauthority.com/2007/06/08/sql-server-insert-multiple-records-using-one-insert-statement-use-of-union-all/[^]