SQL Server insert into -


i trying insert table1(colunm1, column2, column3) column1 has multiple values.

ex:

insert table1 (col1, col2, col3) values (1419002, 1003,          (select tasktypecode            tasktypecodes            tasktypeid in (898,788,878,874)) ) 

error:

msg 512, level 16, state 1, line 2
subquery returned more 1 value. not permitted when subquery follows =, !=, <, <=, >, >= or when subquery used expression. statement has been terminated.

just use insert into..select syntax. try this

insert table1 (col1, col2, col3) select 1419002, 1003, tasktypecode  tasktypecodes  tasktypeid in (898,788,878,874) 

note: based on error mentioned in question above insert query insert more 1 row. if don't want happen restrict rows adding where clause(filter's) or top


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -