Hope22
دوشنبه 29 مهر 1387, 21:03 عصر
این تریگر وقتی می خواد خط آخر رو اجرا کنه به مشکل می خوره
AlterTRIGGER [InsertConsult]
ON Consult
FORINSERT
AS
declare @max2 int
set @max2 =(selectdistinctMax(ID)From Consult)
declare @cn varchar(20)
set @cn=(selectdistinct inserted.Category FROM inserted)
declare @max int
set @max=(SELECTdistinctMax(Row)FROM Consult where(Category = @cn))+1
declare @s int
set @s =(selectdistinct Row From Consult where(Category = @cn))
if @s isnull
Update Consult set Row=1 where(ID = @max2)
Else
Update Consult set Row=@max where(Category = @cn)AND(ID = @max2 );
Error :
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Warning: Null value is eliminated by an aggregate or other SET operation.
The statement has been terminated.
کمک
AlterTRIGGER [InsertConsult]
ON Consult
FORINSERT
AS
declare @max2 int
set @max2 =(selectdistinctMax(ID)From Consult)
declare @cn varchar(20)
set @cn=(selectdistinct inserted.Category FROM inserted)
declare @max int
set @max=(SELECTdistinctMax(Row)FROM Consult where(Category = @cn))+1
declare @s int
set @s =(selectdistinct Row From Consult where(Category = @cn))
if @s isnull
Update Consult set Row=1 where(ID = @max2)
Else
Update Consult set Row=@max where(Category = @cn)AND(ID = @max2 );
Error :
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Warning: Null value is eliminated by an aggregate or other SET operation.
The statement has been terminated.
کمک