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. visual Sdudio 快捷键

    项目相关的快捷键 Ctrl + Shift + B = 生成项目 Ctrl + Alt + L = 显示Solution Explorer(解决方案资源管理器) Shift + Alt+ C = 添加 ...

  2. log4j日志不输出MyBatis SQL脚本?

    日志输出级别调成debug,然并卵? 试试加下这个包. <dependency> <groupId>org.slf4j</groupId> <artifact ...

  3. Hash表算法

    出处:http://blog.csdn.net/v_JULY_v 第一部分:Top K 算法详解问题描述百度面试题:    搜索引擎会通过日志文件把用户每次检索使用的所有检索串都记录下来,每个查询串的 ...

  4. hdu 5780 gcd

    题意:给定$x, n$满足$1 \leq x, n \leq 1000000$,求$\sum{(x^a-1,x^b-1)}$对$1e9+7$取模后的值,其中$1 \leq a, b \leq n$. ...

  5. python(三)set集合

    set集合的特点是无序.不重复序列 创建集合: 1 2 3 4 5 6 7 8 9 10 11 12 13 a.s1 = {11,22} b.s2 = set() c.s3 = set([11,22, ...

  6. Android Volley完全解析

    1. Volley简介 我们平时在开发Android应用的时候不可避免地都需要用到网络技术,而多数情况下应用程序都会使用HTTP协议来发送和接收网络数据.Android系统中主要提供了两种方式来进行H ...

  7. session保存用户登录

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  8. qq2440启动linux后插入u盘出现usb 1-1: device descriptor read/64, error -110,usb 1-1: device not accepting address 8, error -110

    上位机:ubuntu14.04 64bit 下位机:qq2440 交叉编译器:arm-linux-gcc 3.4.1 下位机使用的linux内核版本:kernel2.6.13 1.插入u盘时错误信息如 ...

  9. Android Studio中的六种依赖

    在Android Studio中有六种依赖 Compile,Provided,APK,Test compile,Debug compile,Release compile Compile compil ...

  10. vs2010 vc++ 统一修改所有工程的目录配置

    vs2005和vs2008中都是通过 工具-选项-项目和解决方案-VC++目录,设置 头文件include .库文件lib.可执行文件dll的路径,以便在引用dll动态链接库文件时,可以查找到该文件的 ...