troubleshooting Question

SQL Insert into giver error: Subquery returned more than 1 value.

Avatar of qprsoft
qprsoftFlag for Finland asked on
27 Comments1 Solution848 ViewsLast Modified:
Hi Guys,

Im trying to update a table with the following SQL script but I keep getting an error. Any ideas what might be causing this?


insert into [LMS Notification]
select     AccountBase_dw.Name,Accountbase_dw.AccountID, QPR_DW_2007.LMS_activations_2007.LicenseType, SystemUserBase_dw.InternalEMailAddress,  
                      QPR_DW_2007.LMS_activations_2007.QPRComments, QPR_DW_2007.LMS_activations_2007.UsedBclients,
                      QPR_DW_2007.LMS_activations_2007.UsedDclients, QPR_DW_2007.LMS_activations_2007.UsedPGDclients,
                      QPR_DW_2007.LMS_activations_2007.UsedSCDclients, QPR_DW_2007.LMS_activations_2007.WLT,
                      QPR_DW_2007.LMS_activations_2007.ContactFirstName, QPR_DW_2007.LMS_activations_2007.ContactLastName,
                      QPR_DW_2007.LMS_activations_2007.ContactEmailAddress, AccountBase_dw.StatusCode,QPR_DW_2007.LMS_activations_2007.ProductCode,QPR_DW_2007.LMS_activations_2007.Remote_addr
FROM         AccountBase_dw INNER JOIN
                      SystemUserBase_dw ON AccountBase_dw.OwningUser = SystemUserBase_dw.SystemUserId INNER JOIN
                      QPR_DW_2007.LMS_activations_2007 ON AccountBase_dw.AccountNumber = QPR_DW_2007.LMS_activations_2007.CNumber

Error message:
sg 512, Level 16, State 1, Procedure Licensingevents, Line 21
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.

The select query returns multiple lines, but this is needed as the resultset is over 100000 lines .

EDIT: Found out it is the triggers in the database causing the error. Once I disabled them, import worked OK. How could I get around this?
Join our community to see this answer!
Unlock 1 Answer and 27 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 27 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros