Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my procedure
SQL
ALTER PROCEDURE [dbo].[RmsUpdateRoAssignReAssign1]
(
@XMLAssignRo  AS XML
)
AS
BEGIN
	UPDATE RmsActivity 
				SET 
						RmsProcessorID = DocumentElement.AssignReAssignRo.value('(UserID)[1]', 'INT' ),
						LastUpdatedByID= DocumentElement.AssignReAssignRo.value('(UserID)[1]', 'INT' ),
						LastUpdatedDate=GETDATE()
						
				FROM	
						@XMLAssignRo.nodes('/DocumentElement/AssignReAssignRo') DocumentElement(AssignReAssignRo)
						INNER JOIN RmsUserSkillSet RS
						ON 
							 RS.RmsSkillSetTypeID =  
							 CASE 
								 WHEN DocumentElement.AssignReAssignRo.value('(Aging)[1]', 'INT' )< =20  THEN 1					
								 WHEN DocumentElement.AssignReAssignRo.value('(Aging)[1]', 'INT' ) BETWEEN 21 AND 30  THEN 2
								 WHEN DocumentElement.AssignReAssignRo.value('(Aging)[1]', 'INT' ) >=31 THEN 3							
							 END 
						INNER JOIN tblRoamingUsers RU
						ON RS.RoamingUserID=RU.RoamingUserID
						AND RU.UserID=DocumentElement.AssignReAssignRo.value('(UserID)[1]', 'INT' )
						INNER JOIN tblCampus C
						ON	C.CampusID=DocumentElement.AssignReAssignRo.value('(CampusID)[1]', 'INT' )
						AND RU.SchoolID=C.SchoolID
				WHERE
						RmsActivityID = DocumentElement.AssignReAssignRo.value('(ActivityID)[1]', 'INT' )
END		


i am getting 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.)


'RoamingUserID' is unique for a particular user and campus
i m not able to get y i m getting the above error

[edit]Code block sorted out - OriginalGriff[/edit]
Posted
Updated 8-Oct-12 20:52pm
v2
Comments
Herman<T>.Instance 12-Oct-12 11:16am    
Have you done a select * from.....?
Then you shouls see the problem

1 solution

You might have to check each join where it is giving more than one rows.
U can also use distinct clause where it returns more than one rows.
And rather applying as a case when, u should take as a inner join and then make join.

Regards,
Keep helping nature..!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900