Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 insert record from one table to another table

Author  Topic 

asif372
Posting Yak Master

100 Posts

Posted - 2011-03-10 : 03:47:42
A am Inserting data from one table to another like this
insert into oattnew.dbo.checkinout(USERID,CHECKTIME,CHECKTYPE)
select USERID,CHECKTIME,CHECKTYPE from opltest.dbo.checkinout

but exception ocured
"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated."

any ideas???
Thanks in Advance.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-10 : 04:10:14
i don't see any sub-query in your insert query. Do you have any triggers on that table ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

subhbwn
Starting Member

6 Posts

Posted - 2011-03-10 : 07:20:14
Inserting data from one table to another simply goes like this

INSERT INTO table1
SELECT * FROM table2;

Both of the tables should be identical. You can visit http://www.w3resource.com/sql/insert-statement/insert-using-subqueries.php.
Go to Top of Page
   

- Advertisement -