Solved

How to use select with linked server issue

Posted on 2011-03-12
4
777 Views
Last Modified: 2012-05-11
I need to use a select statement to query a linked server. The following does not work, probably because of the embedded spaces in the database name.
Doesn't work:
select * from [EOSK\DMZ].[BIG JOB COSTS].[dbo].[DNUM]

Open in new window

Does work:
select * from [EOSK\DMZ].[BIG_JOB_COSTS].[dbo].[DNUM]

Open in new window



Why? The item with spaces in the table name is not under my control. Anything I can do.

Bob
0
Comment
Question by:bob_mechler
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 250 total points
Comment Utility
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
>Doesn't work:
error message?

actually, the [ ] should handle the issue with the spaces.
what kind of linked server is it? I presume sql server ...
how have you configured the linked server exactly (options ...) ?
0
 

Author Comment

by:bob_mechler
Comment Utility
Linked server type
SQL Server 2008 64 bit full version. I am not administrator on this database but I am dbo on one database..
I'm using SQL 2008 32 bit Express to do the linking.
Tried the sql server radio button and used oledb.
Once the test connection reported success I then tried the select statement in Express in sql 2008 management studio using the four part connection shown above.

sql express = a
sql 64 bit remote = b

The server b database is replicated from the production database. Server b is in a DMZ zone.
Server b was working fine as the source of data for the website we installed last week.

The other day, I started getting 'Fatal error 9001' from the website as it tried to login to server b. Nothing changed as far as my settings were concerned.

I deduced that since I was running an asp.net 1.1 web site with meta data support in IIS 7 that if I could just copied the 8 tables I needed periodically into emptied tables of the exact same structure on server a that then I could point my web site to server a which is on the same computer as the web site.

I could export one file at a time but when sql express is on either side, import/export I would get a message that said 'run immediately' but would not allow the job to be saved so I could make a job out of it.

I'm looking today at using OPENROWSET since it is infrequent but don't have any assurance that it will work.

Bob
0
 

Author Closing Comment

by:bob_mechler
Comment Utility
The DBA also received the 9001 error so he believed me. We changed the database name to have underscores instead of spaces. Don't know what he did but it is now working fine.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

10 Experts available now in Live!

Get 1:1 Help Now