Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use select with linked server issue

Posted on 2011-03-12
4
Medium Priority
?
785 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
[X]
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
  • 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

722 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