Advertisement

01.03.2005 at 11:03PM PST, ID: 21260758
[x]
Attachment Details

Subquery returned more than 1 value

Asked by shwong2 in MS SQL Server

Tags: more, returned, than, 1, value

Dear all,
I know this question has been asked many times, but I still got the error after tried their solution.

I have MS sql Db table named [Testing] contains four rows and column

[my_Index] [my_Name] [my_Number] [my_Value]
1                angus         2345              temp1
2                angus         2345              temp2
3                kevin          2345              temp3
4                nancy         2345              temp4

Then I run a sql in asp,
"UPDATE [Testing] SET [my_Number]=1 WHERE my_Name='angus'"

In Testing a have trigger to fed the values to other table
All work fine if just 1 row is update

if @@rowcount = 1
Begin
          Set @Status = '1'
End
else
Begin
          Set @Status = (SELECT [my_Index] FROM inserted)
End

and then Insert the value to an aduit table
However, I get the error "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression"

I have tried using IN keyword to fix it but same error occur
Set @Status = (SELECT [my_Index] FROM inserted WHERE [PR_Index] IN (SELECT [PR_Index] FROM inserted))

Can any expert help !!
Start Free Trial
 
Loading Advertisement...
 
[+][-]01.03.2005 at 11:14PM PST, ID: 12950181

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.03.2005 at 11:37PM PST, ID: 12950260

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.03.2005 at 11:44PM PST, ID: 12950279

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.03.2005 at 11:58PM PST, ID: 12950325

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: more, returned, than, 1, value
Sign Up Now!
Solution Provided By: arbert
Participating Experts: 7
Solution Grade: B
 
 
[+][-]01.04.2005 at 12:02AM PST, ID: 12950342

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.04.2005 at 12:10AM PST, ID: 12950368

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.04.2005 at 12:41AM PST, ID: 12950480

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.04.2005 at 02:39AM PST, ID: 12950999

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.04.2005 at 03:33AM PST, ID: 12951197

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.04.2005 at 06:31AM PST, ID: 12952307

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.20.2005 at 01:41AM PDT, ID: 13822293

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32