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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-04-21 : 08:06:47
|
| Spencer writes "I have a problem related to sql server error 512 which is Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.I am hoping you can help me to understand why a query is failing in sql server 2000 but works in sql server 7.0. A table has the following trigger on it:CREATE TRIGGER TimeTableInserted ON Time_Table FOR UPDATEAS Update Time_Table set last_update_dt = GetDate() Where empl_index = (Select empl_index from Inserted) andtime_date_entered = (select time_date_entered from inserted) andtask_index = (select task_index from inserted) andtime_type = (select time_type from inserted) and time_shift = (select time_shift from inserted)I am trying to run a update query like this in Query Analyzer: update time_tableset time_type = 'S'where empl_index = 3000 and time_date_entered > '2003-04-03'Can you tell me why it is failing and what I can do to fix it so that I can run the update query with the trigger still in place? Many thanks in advance. Spencer" |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2003-04-21 : 08:38:13
|
| Try This :ALTER TRIGGER TimeTableInserted ON Time_Table FOR UPDATEAS Update Time_Table set last_update_dt = GetDate()FROM TIME_TABLE T INNER JOIN INSERTED I ONT.empl_index = I.empl_index andT.time_date_entered = I.time_date_entered andT.task_index = I.task_index andT.time_type = I.time_type and T.time_shift = I.time_shiftGOSekar~~~~Success is not a destination that you ever reach. Success is the quality of your journey. |
 |
|
|
spencey
Starting Member
1 Post |
Posted - 2003-04-24 : 06:39:22
|
| That works perfectly. Thanks Sekar. Spencer |
 |
|
|
|
|
|