> I have a Tagdataminutely table with columns TagKey,
> datetime, Value, Quality and Rev. TagKey is not a primary
> key in this table, in fact this table has no primary key
> at all. When an Update statement is issued on Value or
> Quality or Rev fields, the new value specified in update
> statement replaces old value but rev and quality field
> always retain their old values.
> For this I have used deleted table and an Update function
> inside trigger on that table and update Tagdataminutely
> table with old values...
> If update(value) or update(rev) or update(quality)
> update Tagdataminutely
> set Quality = (Select deleted.Quality from
> deleted where deleted.[datetime] = tagdataminutely.
> [datetime] and deleted.Tagkey = tagdataminutely.Tagkey),
> Revlevel = (Select deleted.revlevel from deleted
> where deleted.[datetime] = tagdataminutely.[datetime] and
> deleted.Tagkey = tagdataminutely.Tagkey ) where [datetime]
> >= sdtMinStartDate and [datetime] <= sdtMaxEndDate
> The error message I get is :
> 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.
> Can I limit the returned resultset from subquery to a
> single value for all records in deleted table one by
> Do I have to loop thru cursor and update the table for
> each records one by one, which is very slow as the updates
> on this table could happen in the magnitude of 1000s in
> few minutes....
> Help is very much appreciated.