Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
使用一句SQL INSERT多筆Record(multiple values)
此功能在MySQL在3.22.5之後就有的功能,SQL Server在這個SQL Server 2008版本才加入此功能
-- 切換測試資料庫
USE MyDB
GO
-- 建一個測試資料表
CREATE TABLE [mytable]
(
myid
nvarchar(10)
,givenName
nvarchar(50)
,email
nvarchar(50)
);
GO
-- 一次Insert 多筆資料
INSERT INTO [mytable]
VALUES
('01','Brad','brad@test.com')
,('02','Siliva','siliva@test.com')
,('03','Allen','Allen@test.com');
GO
-- 檢查資料是否正確寫入
SELECT * FROM [mytable];