我是使用SQL Server的新手,並且遇到此問題。我不知道如何連接才能將多個值插入到一個列表中。將多個值插入到SQL Server表中
INSERT INTO Table (Column)
VALUES ('Name'+','+' Last name',);,('Name'+','+'Last name',);
而且我得到這個錯誤:
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.
我是使用SQL Server的新手,並且遇到此問題。我不知道如何連接才能將多個值插入到一個列表中。將多個值插入到SQL Server表中
INSERT INTO Table (Column)
VALUES ('Name'+','+' Last name',);,('Name'+','+'Last name',);
而且我得到這個錯誤:
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.
INSERT INTO Table (Column)
VALUES ('Name'+','+ 'Last name') --<-- no comma required inside the paranthesis
,('Name'+','+ 'Last name'); --<-- only need semi-colon here
使用時應使用|| concatenate的符號。 例如:SELECT first_name || ' ' || last_name FROM hr.employees;
這是針對sql server的。你不能使用'||'連接 – ughai
可能重複[如何插入多行而不重複聲明的「INSERT INTO dbo.Blah」部分?](http://stackoverflow.com/questions/2624713/how-do- i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part) –