SqlServer 跨库访问
同实例跨库
只需要 库名.dbo.表 dbo可省略 如:
use Test
select * from rdrecords
select * from oa.dbo.UserInfo
不同实例与不同ip是相同的
exec sp_addlinkedserver 'ITSV ', ' ', 'SQLOLEDB ', '.,1333'
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'sa ', 'sa' select * from itsv.swie.dbo.a_base exec sp_dropserver 'ITSV ', 'droplogins '
还可以这样
select * from openrowset( 'SQLOLEDB ', '.,1333'; 'sa'; 'sa',swie.dbo.a_base)
/*
执行出错 出下列信息时 要执行下边的开操作
消息 15281,级别 16,状态 1,第 1 行
SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的
STATEMENT 'OpenRowset/OpenDatasource' 的访问,
因为此组件已作为此服务器安全配置的一部分而被关闭。
系统管理员可以通过使用 sp_configure 启用 'Ad Hoc Distributed Queries'。
有关启用 'Ad Hoc Distributed Queries' 的详细信息,请参阅 SQL Server 联机丛书中的
"外围应用配置器"。
*/
--开
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure --关
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
SqlServer 跨库访问的更多相关文章
- Postgresql ODBC驱动,用sqlserver添加dblink跨库访问postgresql数据库
在同样是SQLserver数据库跨库访问时,只需要以下方法 declare @rowcount int set @rowcount =(select COUNT(*) from sys.servers ...
- SQLServer跨服务器访问数据库(openrowset/opendatasource/openquery)
SQLServer跨服务器访问数据库(openrowset/opendatasource/openquery) 1.启用Ad Hoc Distributed Queries 在使用openrowset ...
- postgresql 模式与用户,及跨库访问
1 控制台命令\h:查看SQL命令的解释,比如\h select.\?:查看psql命令列表.\l:列出所有数据库.\c [database_name]:连接其他数据库.\d:列出当前数据库的所有表格 ...
- SqlServer跨库查询
由于业务的拆分,数据库拆分为两种作用: 汇总数据库(Master,头节点数据库), 子节点数据库(Compute Node,计算子节点数据库) 这样,就设计到子节点访问头节点数据库中的某张汇总表,这种 ...
- SQLServer跨库查询--分布式查询
出处:http://www.cnblogs.com/doosmile/archive/2012/03/16/2400646.html --用openrowset连接远程SQL或插入数据 --如果只是临 ...
- SQLServer跨库查询--分布式查询(转载)
--用openrowset连接远程SQL或插入数据 --如果只是临时访问,可以直接用openrowset --查询示例 select * from openrowset('SQLOLEDB' ,'sq ...
- [转]SQLServer跨服务器访问数据库(openrowset/opendatasource/openquery)
正 文: 1.启用Ad Hoc Distributed Queries 在使用openrowset/opendatasource前搜先要启用Ad Hoc Distributed Queries服务,因 ...
- SQLServer 跨库查询实现方法
不使用链接的服务器名,而提供特殊的连接信息,并将其作为四部分对象名的一部分 本文给出一条 SQL 语句用于展示在同一名服务器上,不同的数据库间查询,注意当前连接用户要对两个库都有权限SQL Serve ...
- Oracle跨库访问数据表-DBLINK
1:创建DBLINK(USING后面的连接字符串就是要访问的那个数据库的连接字符串) CREATE DATABASE LINK linkName CONNECT TO userName IDENTIF ...
随机推荐
- Apache Shiro 集成Spring(二)
1.依赖: <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-cor ...
- Debug your ASP.NET Application while Hosted on IIS
转摘:http://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS This ...
- RxJava的学习与实现
RxJava 要在Android中使用RxJava2, 先添加Gradle配置: compile 'io.reactivex.rxjava2:rxjava:2.0.1' compile 'io.rea ...
- openssl部分解读
前言 openssl是个开源的加密库.可以对文件进行加密解密. 小知识 术语: 单词: Encryption 加密 Decryption 解密 ssl 安全socket层 tsl 最 ...
- 西电源ubuntu12
deb http://linux.xidian.edu.cn/mirrors/ubuntu/ precise main restricted universe multiverse #deb-src ...
- 查看tomcat的版本号
本经验主要介绍在windows下,如何查看tomcat的版本号. 工具/原料 安装了tomcat server的操作系统. 一.绿色版tomcat版本查看--命令catalina version 或者 ...
- springboot不能用 @SpringApplicationConfiguraction 解决方案
@SpringApplicationConfiguraction 是在springboot 1.4之前,之后改用 @RunWith(SpringJUnit4ClassRunner.class) @S ...
- Halo(二)
@Conditional 满足条件给容器注册Bean(在配置类 @Configuration 的类和方法上配置) 需要实现Condition接口, 实现matches方法 public class L ...
- Spring data jpa persistence .xml 配置文件
<?xml version="1.0" encoding="UTF-8"?><persistence xmlns="http://j ...
- 【Flutter学习】之动画实现原理浅析(一)
一,动画介绍 动画对于App来说,非常的重要.很多App,正是因为有了动画,所以才会觉得炫酷.移动端的动画库有非常的多,例如iOS上的Pop.web端的animate.css.Android端的And ...