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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -