zoukankan      html  css  js  c++  java
  • Create Linked Server SQL Server 2008

    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

    Linked Server Step 1

    Linked Server Step 2

    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.

  • 相关阅读:
    UEditor用法
    String,StringBuffer与StringBuilder差异??
    TsFltMgr.sys其原因是,该系统蓝屏QQ计算机管理器!
    Linux编程实现守护进程
    开机黑屏 只显示鼠标 电脑黑屏 有只老鼠 举 [我们已经成功地解决了]
    页面背景图像的代码
    动态规划01背包问题
    关键部分CCriticalSection使用
    编程:获取股票实时行情数据大全
    iphone开发教程下载
  • 原文地址:https://www.cnblogs.com/wangjiahong/p/5054468.html
Copyright © 2011-2022 走看看