问题描述
我猜想从此脚本内部以某种形式使用sqlcmd将是答案之一,但坐在这里时要打开ssmse并准备好编写新查询" ...是T-SQL中的一些switch命令,我可以在这些实例之间移动.
最终,我希望对多个数据库中的每个数据库都产生广泛的影响,并合成结果.
我现在能想到的就是使用"sqlcmd -i"命名实例,然后再命名另一个.sql脚本,以完成制表数据,然后在下一个实例上再次运行它.
我相信local->远程-> local再也可以吗?
我在可编程脚本可签出的功能强大的清单中看到sp_addlinkedserver.我可能要做的就是在链接到远程"服务器后添加远程"数据库的名称,对吧?
I''m guessing that using sqlcmd in some form from inside this script is going to be one of the answers but sitting here with ssmse open and a "new query" ready to be written ... there''s gotta be some switch command in T-SQL where I can move between the instances.
Ultimately I wish to run a broad spectrum effect on each of several databases and composit the results.
All I can think of doing right now is to use "sqlcmd -i" naming the instance then another .sql script, to completion tabulating data, then run it again on the next instance ...
I believe the local->remote->local again is ok with that?
I see sp_addlinkedserver in the towering list of things available in the programmability scripts to check out. All I might have to do is add the name of the "remote" database after linking in the "remote" server, right?
推荐答案
这篇关于在T-SQL中,(最好使用ssmse运行此.sql脚本)...如何从一个脚本访问两个正在运行的sql实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!