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. Windows:常见问题

    1.文件(夹)非法字符 Windows系统文件(夹)非法字符"\\/:*?\"<>|",不包含‘.’,但"."字符不能是文件(夹)的首字符 ...

  2. win7下JDK环境变量设置方法

    来源于:http://jingyan.baidu.com/article/e9fb46e1b2b3347521f766c1.html

  3. 【转】本地存储-localStroage/sessionStorage存储

    原文地址:[js学习笔记-103]----本地存储-localStroage/sessionStorage存储 客户端存储 l  WEB存储 web存储最初作为html5的一部分被定义成API形式,但 ...

  4. 20160330001 调用及触发Office Outlook 约会

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  5. 关于file的上传文件

    http://blog.csdn.net/wclxyn/article/details/7090575/

  6. Java Code Examples for PhantomJSDriverService

    Example 1 Project: thucydides   File: PhantomJSCapabilityEnhancer.java View source code Vote up 6 vo ...

  7. C++实现树的基本操作,界面友好,操作方便,运行流畅,运用模板

    Ⅰ.说明: .采用左孩子右兄弟的方式,转化为二叉树来实现. .树的后根遍历与二叉树的中根遍历即有联系又有区别,请读者注意分析体会. Ⅱ.功能: .创建树并写入数据 .先根遍历树 .计算树高 .后根遍历 ...

  8. c# 与java之间的简单区别

    C#中类的继承用通过冒号:实现,在Java中用extends C#中实现接口通过冒号:实现,在Java中用implements C#中密封类用sealed实现,在Java中用final C#中常数用c ...

  9. DSO激活时,生成主数据SID时报错:原因,主数据允许小写字母没有勾上

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  10. Java 中的 static 使用之静态变量

    大家都知道,我们可以基于一个类创建多个该类的对象,每个对象都拥有自己的成员,互相独立.然而在某些时候,我们更希望该类所有的对象共享同一个成员.此时就是 static 大显身手的时候了!! Java 中 ...