Error joining tables from separate db's using SqlCommand object

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Corbin (corbinamman_at_gmail.com)
Date: 01/25/05


Date: 25 Jan 2005 11:04:16 -0800

I'm trying to run a query that joins tables from 2 databases on the
same server. The query is like this:

SELECT TitleID, u.Name as Assignee
FROM tblTitle t
LEFT JOIN titlepost..Portal_Users u
ON t.TitleProcessor = u.email

When I put it in a stored procedure and execute the sp using SqlCommand
object, there are no problems. But I need to be able to run this query
using the CommandText property rather than by calling a stored
procedure. When I attempt this, I get "Invalid object name
'titlepost.dbo.PortalUsers'". My connection string is
"server=10.10.10.10;Trusted_Connection=true;database=abstractors"
Any suggestions are appreciated.

Corbin



Relevant Pages

  • Re: noise words, @@ERROR, and stop and resume indexing
    ... > Noiseword varcharNot Null ... > the data from the noise file to the noise_words table. ... >> A clause of the query contained only ignored words. ... >> into query analyzer before starting the stored procedure. ...
    (microsoft.public.sqlserver.fulltext)
  • RE: ODBC query in VB code Need HELP
    ... I am trying to get a stored procedure to run on info I send it I do not need ... I played around and got the code below to work using a pass-through query, ... Dim strpass As String ...
    (microsoft.public.access.formscoding)
  • Re: slowing/halting stored procedure from ado.net
    ... calling the same stored procedure from SQL> Management ... > Studio goes without any slowdown, ... > There was/is no big job running on the sql server, ... >> Erratic performance of any query is usually due to something changing. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Database Engine Tuning Advisor suggestion to replace syntax.
    ... Actually, what I said was "IF this code is running in a stored procedure", ... execution with the execution plan generated for the first execution. ... SQL Server does not have to compile the second statement." ... replace query 1 below with the syntax in query 2 below. ...
    (microsoft.public.sqlserver.tools)
  • Re: Query parameters - Tricky Stored Procedure Question
    ... Dim tConnection As SqlConnection = New SqlConnection ... Here you would pass in your constructed ad-hoc query ... This is one case in which an inline ad-hoc query would be preferable ... how is it possible to create a stored procedure which can ...
    (microsoft.public.dotnet.languages.vb)