我使用如下触发器,当数据量大于1000时总提示:timeout,如何解决这个问题?
CREATE TRIGGER updateTel ON dbo.y_main
FOR UPDATE
AS
declare @code char(4),
@telnum1 char(20),
@id char(18),
@row decimal(18)
if update(telnum1)
begin
declare c_update1 cursor for select left(code,4),RTRIM(telnum1),id from inserted
open c_update1
set @row=@@cursor_rows
while @row >0
begin
fetch c_update1 into @code,@telnum1,@id
update yellowpage set telnum1=@telnum1 where id=@id
exec ( 'update y'+@code+ ' set tel='+@telnum1+' where id ='+@id)
set @row=@row-1