sql server - SSMS 2014 - Cannot insert multiple values into table variable -


this trivial i'm missing, can't seem figure out why it's not working:

basically, works:

declare @names table (name nvarchar(100));  insert @names values ('john'); 

but not:

declare @names table (name nvarchar(100));  insert @names values ('john'), ('jane'); 

i'm getting error:

msg 102, level 15, state 1, line 5
incorrect syntax near ','.

why wouldn't work? i've done thousands of times ssms 2008.

sql server table value constructor (transact-sql) introduces in sql server 2008.

sql server 2008 , later

declare @names table (name nvarchar(100)); insert @names values     ('john'),     ('jane'); 

sql server 2000 , later

any older version need use single row insert @ time

declare @names table (name nvarchar(100)); insert @names values('john'); insert @names values('jane'); 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -