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 2000 Forums
 SQL Server Development (2000)
 Trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-28 : 08:36:24
Manoj writes "Dear friends;

When multiple records are effected in the table, trigger returns the error message multiple records retunr by subquery. Pls help me to solve this problem with example.

Thanks

manoj"

Nazim
A custom title

1408 Posts

Posted - 2002-05-28 : 09:02:17
you should have posted your trigger code.

Anywayz, somewhere in your trigger a subquery is returning multiple values where a single value is expected.

something like this

select * from tablename where colum = (select column from table1 where columns=343)

if the subquery here returns more then one value it generates the error you are getting. to go away with the error , i can replace the = sign with in.

HTH

--------------------------------------------------------------
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-28 : 09:15:50
To solve this, manoj, you need to remember that the inserted/updated trigger-tables contain the set of data effect by dml, not an individual record. Like Nazim said, review your trigger code with this fact in mind.

<O>
Go to Top of Page

Manoj Kayastha
Starting Member

3 Posts

Posted - 2002-05-29 : 08:58:21
I am using MS Access as Front end. When more than one records are going to update or deleted,the trigger popup the error message showing sub query has returned many rows. If one record at a time deleted or updated, it is fine. This is a problem. Someone says that the trigger will not allow the multiple records transaction, it needs Storeprocedure. It is the problem, I have no idea to write such storeprocedure. Pleas help.

Manoj

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-29 : 09:04:45
quote:

I am using MS Access as Front end. When more than one records are going to update or deleted,the trigger popup the error message showing sub query has returned many rows. If one record at a time deleted or updated, it is fine. This is a problem.


please re-read the post by Nazim and myself.....asked and answered.

quote:

Someone says that the trigger will not allow the multiple records transaction, it needs Storeprocedure. It is the problem, I have no idea to write such storeprocedure.



Was someone talking about Microsoft SQL Server? Someone was wrong.

<O>
Go to Top of Page
   

- Advertisement -