INSERT 多行不工作 SQL Server 2008 R2
INSERT multiple rows not working SQL Server 2008 R2
这似乎是一个愚蠢的问题,但一直让我抓狂。标题几乎说明了这一点:我无法在我的 table 中插入多行。
相关代码如下:
create table ##temp (
no1 int,
no2 int
)
insert into ##temp (no1,no2)
values
(1,2),
(3,4)
错误是
Incorrect syntax near ','
这是(1,2)和(3,4)之间的逗号
希望有人能提供帮助。顺便说一句,我正在使用 SQL Server 2008 R2。谢谢..
试试这个:
insert into ##temp (no1,no2)
select 1, 2
union select 3, 4
这似乎是一个愚蠢的问题,但一直让我抓狂。标题几乎说明了这一点:我无法在我的 table 中插入多行。
相关代码如下:
create table ##temp (
no1 int,
no2 int
)
insert into ##temp (no1,no2)
values
(1,2),
(3,4)
错误是
Incorrect syntax near ','
这是(1,2)和(3,4)之间的逗号
希望有人能提供帮助。顺便说一句,我正在使用 SQL Server 2008 R2。谢谢..
试试这个:
insert into ##temp (no1,no2)
select 1, 2
union select 3, 4