想做触发器插入表时获取城市名称 ,然后更新
declare @City char(10)
select @City=City from EAinfo where Id=20998update [10.0.10.2].database1.dbo.Einfo set Area=@City
where ID=438551
问题是通过查询分析器执行无回应长时间等待,触发器里插入失败
单独执行update [10.0.10.2].database1.dbo.Einfo set Area="ssss"
where ID=438551
可以正常通过。执行本地数据库
declare @City char(10)
select @City=City from EAinfo where Id=20998update Einfo set Area=@City
where ID=438551
可以正常通过
declare @City char(10)
select @City=City from EAinfo where Id=20998update [10.0.10.2].database1.dbo.Einfo set Area=@City
where ID=438551
问题是通过查询分析器执行无回应长时间等待,触发器里插入失败
单独执行update [10.0.10.2].database1.dbo.Einfo set Area="ssss"
where ID=438551
可以正常通过。执行本地数据库
declare @City char(10)
select @City=City from EAinfo where Id=20998update Einfo set Area=@City
where ID=438551
可以正常通过
where ID=438551
的
问题是加了变量批量执行时就不行了
select @City=City from EAinfo where Id=20998--update [10.0.10.2].database1.dbo.Einfo set Area=@City where ID=438551
exec ('update [10.0.10.2].database1.dbo.Einfo set Area=''' + @City + ''' where ID=438551')
如果
exec('
declare @City char(10)
select @City=City from EAinfo where Id=20998update [10.0.10.2].database1.dbo.Einfo set Area=@City
where ID=438551')
又是相同结果,执行无回应