Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Linked Servers Between Local SQLExpress 2008 & Remote SQL2008?

Posted on 2010-09-24
3
1,006 Views
Last Modified: 2012-05-10
This code worked linking two local SQLExpress 2005 on two seperate PCs. However, I cannot get connection to work while testing from Local SQLExpress and Interent remote SQL 2008 Server.

I have tcp1433 open.
The following code runs 'Successfully' without errors

Linked Server show locally: select * from master..sysservers

[Code That Worked - Local to Local SQLExpress 2005 From C# App]
Exec sp_addlinkedserver @server = '" + remotePcName + "', @srvproduct = '', @provider = 'SQLNCLI', " +
@" @provstr = 'DRIVER={SQL Server};SERVER=" + remotePcName + @"\SQLEXPRESS;Trusted_Connection=yes;'

[Code 'Attempt' Local SQLExpress 2008 to Remote SQL 2008 From MS Mgt Studio 2008]
Exec sp_addlinkedserver
@server = 'RemoteSql', --friendly name
@srvproduct = '',
@provider = 'SQLNCLI',
@provstr = 'DRIVER={SQL Server};Server=tcp:sql2k801.discountasp.net;Initial Catalog=SQL2008_123456_database1;User ID=mysecretid;Password=mysecretpassword;'

I contacted DiscountASP support (no help), did find linked servers are allowed (kb articles).

Help EE....
0
Comment
Question by:pointeman
  • 2
3 Comments
 
LVL 15

Expert Comment

by:MohammedU
ID: 33755794
I believe remote connections are disabled in SQL Express by default...
Make sure you enable remote connections...
check the following blog for how enable...

http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx
0
 

Author Comment

by:pointeman
ID: 33756515
Untrusted domain errors now.
0
 

Accepted Solution

by:
pointeman earned 0 total points
ID: 33757119
SOLUTION:
Before runing sp_addlinkedserver or doing anything else, perform the following task:
1. Login to SQL Server Management Studio 2008 as 'Administrator' ( Windows Authentication or SA)
2. Go to Securtiy -> Logins: create login using same 'user id' and 'password' as Remote login
3. Assign role 'sysadmin' and default database 'master'
4. Logout and LOGIN as the newly created login user and password
5. Now run sp_addlinkedserver
6. Go to Server Objects -> Linked Servers -> mylinkedservername -> remotedbname -> Tables (All show)
7. Run this query: use master;  Select * From mylinkedservername.master.dbo.sysdatabases (approx 3 rows show)
8. Run this query: Select * From mylinkedservername.remotedbname.dbo.mytablename (returns all rows)
This worked for me, hope I didn't miss anything, details... details...
 
 
 
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
OSQL to execute sql command 26 24
SQL Server - Copy database from one server to another 3 32
AD and SQL Server 2016 2 29
SQL USE DATABASE VARIABLE 5 30
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question