Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to use select with linked server issue

Posted on 2011-03-12
4
Medium Priority
?
786 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:
Rahul Agarwal earned 750 total points
ID: 35120169
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 750 total points
ID: 35121456
>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
ID: 35122851
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
ID: 35142776
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 your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

In this article I will describe the Detach & Attach 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.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

971 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