Solved

Linked Servers Between Local SQLExpress 2008 & Remote SQL2008?

Posted on 2010-09-24
3
1,003 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Error in WHERE Clause 5 42
Microsoft Azure SQL - create a read only user 2 17
SSRS troubles 4 23
SQL View Syntax case etc 5 0
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now