Solved

Linked Servers Between Local SQLExpress 2008 & Remote SQL2008?

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Select Query help 1 34
Searching a barcode number within a string. 7 24
sql query 5 37
Converting Stored Procedure to SQL Statement 5 36
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

679 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