Hi when i execute the following TSQL, i get the error message below. But there is nothing wrong with the SQL syntax is there?
create table #tb ([t1] tinyint, [t2] varchar(50))
insert into #tb values
(1, 'a'),
(2, 'b')
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ‘,’.
There is nothing else in the SQL query window. Running SQL Server 2005.
As jmoreno mentions, the
VALUES (), ()syntax is SQL Server 2008+ supported but you tagged this as SQL Server 2005.Use:
It’s also possible to do this in a single query, using the
SELECT ... INTOclause, but the temp table can’t already exist: