我有一个游标及其获取数据库名称和链接服务器名称,以在每个游标中执行一个过程
Declare getDBLinkServer cursor for
select DatabaseName, LinkServerName from DBnLinkServer
Open getDBLinkServer
fetch next from getDBLinkServer into @DatabaseName, @LinkServerName
While @@FETCH_STATUS = 0
Begin
exec @LinkServerName.@DatabaseName.dbo.someProcedure 'some'
fetch next from getDBLinkServer into @DatabaseName, @LinkServerName
End
Close getDBLinkServer
Deallocate getDBLinkServer
这显示了Incorrect syntax near '.'
如何避免它?