Advertisement

05.19.2008 at 04:21PM PDT, ID: 23415494
[x]
Attachment Details

SQL Server ODBC Data Source set to correct database, but selects results from wrong database

Asked by TerryAtOpus in SQL Server 2005, MS SQL Server

Tags: sql server, odbc, data source, database

I have several SQL Server ODBC data sources for different databases used by a software package I do user support for. The databases are CPM_DUN, CPM, CPM_HAM, and CPM_BOP. All the data sources look fine, and pass the connection tests. I've checked them very thoroughly for any differences, and found none other than (as intended) the database name itself.

However, the data source for the CPM_HAM database is retrieving data from the CPM database when I run a query against it using MS Query from Excel. In fact, when I manually tell it to run the SQL:
  select main_menu from f_system
and go back to edit the SQL, MS Query has changed it to be:
  SELECT f_system.MAIN_MENU
  FROM CPM.dbo.f_system f_system

As you can see, it's accessing the CPM database instead of the CPM_HAM database, which is wrong.

When I do the same thing using my data source for CPM_DUN, there's no issue - the query works fine and is updated to be:
  SELECT f_system.MAIN_MENU
  FROM CPM_DUN.dbo.f_system f_system

Which is correct.Start Free Trial
Attachments:
 
CPM_HAM data source test
CPM_HAM data source test
 
[+][-]05.19.2008 at 04:43PM PDT, ID: 21602456

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.19.2008 at 05:10PM PDT, ID: 21602552

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, MS SQL Server
Tags: sql server, odbc, data source, database
Sign Up Now!
Solution Provided By: TerryAtOpus
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.19.2008 at 05:15PM PDT, ID: 21602576

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 05:23PM PDT, ID: 21602610

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 07:09PM PDT, ID: 21603116

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 11:03PM PDT, ID: 21603787

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906