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
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Subquery returned more than 1 value

Author  Topic 

rawbeefman
Starting Member

2 Posts

Posted - 2008-01-26 : 19:14:44
Okay,
I want to fill a table in one database with some info from an identical table from another database. When I run this query, I get the following error:

"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."

But the point of the subquery was to in fact return more than one value.

rawbeefman
Starting Member

2 Posts

Posted - 2008-01-26 : 20:56:52
Here is my query:

"INSERT INTO CLEAR.dbo.Assets (CompanyID,BuildingID,FloorID,RoomID,ClassID,DepreciationID,TagNumber)
(SELECT CompanyID,BuildingID,FloorID,RoomID,ClassID,DepreciationID,TagNumber
FROM MAIN.dbo.Assets WHERE CompanyID=56)"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-28 : 02:01:11
INSERT INTO CLEAR.dbo.Assets (CompanyID,BuildingID,FloorID,RoomID,ClassID,DepreciationID,TagNumber)
SELECT CompanyID,BuildingID,FloorID,RoomID,ClassID,DepreciationID,TagNumber
FROM MAIN.dbo.Assets WHERE CompanyID=56

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -