,
SQL Server 2005 では、次の間を使用できませんvalues
。
交換:
INSERT INTO Employees
VALUES(N'593705', N'Frank Somah', N'20061004', 26.15),
(N'720947', N'Paul Handsome', N'20000802', 36.05);
withまたはSELECT
multiple :UNION ALL
INSERT...VALUES...
INSERT INTO Employees
SELECT N'593705', N'Frank Somah', N'20061004', 26.15
UNION ALL
SELECT N'720947', N'Paul Handsome', N'20000802', 36.05
INSERT INTO Employees
Values(N'593705', N'Frank Somah', N'20061004', 26.15)
INSERT INTO Employees
Values(N'720947', N'Paul Handsome', N'20000802', 36.05)
GO
INSERT INTO Employees(EmployeeName, EmployeeNumber, DateHired)
VALUES(N'Clarice Simms', N'971403', N'20011112');
GO
したがって、完全なスクリプトは次のようになります。
CREATE TABLE Employees
(
EmployeeNumber nchar(10),
EmployeeName nvarchar(50),
DateHired datetime,
HourlySalary money
);
GO
INSERT INTO Employees
select N'593705', N'Frank Somah', N'20061004', 26.15
union all
select N'720947', N'Paul Handsome', N'20000802', 36.05
GO
INSERT INTO Employees(EmployeeName, EmployeeNumber, DateHired)
VALUES(N'Clarice Simms', N'971403', N'20011112');
GO