From:http://www.jensbits.com/2010/11/10/create-linked-server-sql-server-2008/

http://www.c-sharpcorner.com/uploadfile/suthish_nair/linked-servers-in-sql-server-2008/

Creating a linked server in SQL Server 2008 is a great way to run CRUD statements against a completely different remote server. This method relies on Windows Authentication.

This is only one way to do it. There are others. And, if you are going to run SQL statements against a linked server from a web app, you need to have the permissions set up properly. From the article “How do I… Query foreign data using SQL Server’s linked servers?” by Susan Harkins:

The biggest catch to all this simplicity is, as always, security. If you’re working with Windows Authentication, the system accommodates well. If the user has the appropriate permissions for the servers and data sources, linked queries will work.

If you have users outside the Windows Authentication environment, you can use a linked login. Create a standard login and assign the appropriate permissions on the remote server.

Setting It Up

  1. Go to “Server Objects” of the database server where the linked server will be added and right click on “Linked Servers”. Select “Add New Linked Server”.
  2. In the “General” tab, add a name for the new linked server in the “Linked Server” field.
  3. Select “Other data source”and for “Provider” select “Microsoft OLE DB for SQL Server”
  4. For “Product Name” type in “SQLOLEDB”
  5. In the “Data Source” field, enter the IP address of the server to be linked
  6. “Catalog” is the name of the database on the linked server and is optional
  7. Go to the “Security” tab and select “Be made using this security context”. Type in the remote login and credentials

Running Queries

To query against this server user the syntax:

SELECT FROM [MY_LINKED_SERVER].[database_name].[dbo].[table_name]

Or, for a join, use linked table with an alias (example):

SELECT FROM Table
    RIGHT OUTER JOIN
    [MY_LINKED_SERVER].[database_name].[dbo].[table_name] LinkedTable
    ON Table.column = LinkedTable.column

This is a start. Where you go from here is up to you.

Create Linked Server SQL Server 2008的更多相关文章

  1. .NET编程和SQL Server ——Sql Server 与CLR集成 (学习笔记整理-1)

    原文:.NET编程和SQL Server ——Sql Server 与CLR集成 (学习笔记整理-1) 一.SQL Server 为什么要与CLR集成 1. SQL Server 提供的存储过程.函数 ...

  2. [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]列名 'user1' 无效

    唉,还是自己对php执行sql语句运用不熟练.... 我的错误代码是这样的,(解决办法在最后) $re=sqlsrv_query($conn, "select * from visitor ...

  3. [ERROR]pyodbc.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]SQL Server 阻止了对组件“xp_cmdshell”的 过程“sys.xp_cmdshell”的访问

    环境: Windows 2012 R2 SQL Server 2014 通过MSSQL查询数据库服务器时间,报错如下: pyodbc.ProgrammingError: (', '[42000] [M ...

  4. [转]create a basic sql server 2005 trigger to send email alerts

    本文转自:http://blog.netnerds.net/2008/02/create-a-basic-sql-server-2005-trigger-to-send-e-mail-alerts/ ...

  5. Create the first sql server 2016 mobile report;创建 第一个 sqlserver 2016 Mobile report

    在微软收购了datazen之后,sqlserver2016 集成了mobilereport,mobile report 基于html5,兼容各类主流浏览器,之前ssrs2008 R2中很多chart类 ...

  6. SQL Server ->> SQL Server 2016重要功能改进之 -- INSERT SELECT时并发插入数据

    SQL Server 2016对INSERT INTO XXXX SELECT语句进行了优化,在某些情况下可以触发数据的并行插入,但是要求兼容模式是130(SQL Server 2016)以及在插入的 ...

  7. SQL Server ->> SQL Server 2016新特性之 -- Dynamic Data Masking

    Dynamic Data Masking是为了防止敏感数据暴露给未经授权的用户,以一种最小开销和维护成本的形式.Dynamic Data Masking用于表的字段,相当于盖住字段数据的一部分.比如一 ...

  8. C#构造方法(函数) C#方法重载 C#字段和属性 MUI实现上拉加载和下拉刷新 SVN常用功能介绍(二) SVN常用功能介绍(一) ASP.NET常用内置对象之——Server sql server——子查询 C#接口 字符串的本质 AJAX原生JavaScript写法

    C#构造方法(函数)   一.概括 1.通常创建一个对象的方法如图: 通过  Student tom = new Student(); 创建tom对象,这种创建实例的形式被称为构造方法. 简述:用来初 ...

  9. [MS SQL Server]SQL Server如何开启远程访问

    在日常工作中,经常需要连接到远程的MS SQL Server数据库中.当然也经常会出现下面的连接错误. 解决方法: 1. 设置数据库允许远程连接,数据库实例名-->右键--->属性---C ...

随机推荐

  1. WinForm中跨线程操作控件

    在WinForm编程时会遇到通过后台线程操作界面的情况,直接在后台线程执行的方法中直接操作控件会报错,这时候就要使用跨线程方式间接操作控件.下面是两种实现方式.   1.采用定义delegate的方式 ...

  2. HTML之常用标签

    一.H标签 标题(Heading)是通过<h1>-<h6>等标签进行定义的. <h1>定义最大的标题,<h6>定义最小的标题. 未完待续....

  3. php将抓取的图片链接下载到本地

    备注: fclose这一步操作完成之后如果返回值是空表示下载成功,否则会返回1或者其他错误提示 这个步骤测试的时候实在yii2框架的基础上执行的,下载到的图片实在frontend目录下的web目录下( ...

  4. 2016年12月19日 星期一 --出埃及记 Exodus 21:14

    2016年12月19日 星期一 --出埃及记 Exodus 21:14 But if a man schemes and kills another man deliberately, take hi ...

  5. Oracle、Microsoft SQL Server、Mysql

    数据库对比.----1.Oracle:最贵,功能最多,安装最不方便,Oracle环境里的其他相关组件最多,支持平台数量一般,使用中等方便,开发中等方便,运维中等方便,不开源,速度最慢,最安全.---- ...

  6. hadoop2.0初识1.1

    1.伪分布式hdfs文件系统的搭建(单节点文件系统) 1.1.根据上节的讲解,配置主机映射.jdk和解压hadoop压缩包 1.2.配置namenode 在/opt/modules/hadoop-2. ...

  7. ConsensusClusterPlus根据基因表达量对样品进行分类

    #http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2881355/ 一致聚类方法,采用重抽样方法来验证聚类合理性. library(ALL)data(ALL)d ...

  8. windows中的程序放在linux上因为字符集不同出错

    问题 在把windows下的一个python脚本挪到linux下的时候,出现了一个奇怪的问题,就是标题那样的报错,很明显,shell没有用对应的python解释器去解释脚本,而是直接用shell解释了 ...

  9. Java 集合 - ArrayList

    源码分析 属性 // 默认的初始化容量 private static final int DEFAULT_CAPACITY = 10; // 用于无参构造中初始化一个空数组 private stati ...

  10. Eclipse 修改API

    真机调试时报错,提示application api 21,device api 10 Automatic Target Mode: Unable to detect device compatibil ...