Error joining tables from separate db's using SqlCommand object

From: Elton Wang (anonymous_at_discussions.microsoft.com)
Date: 01/27/05


Date: Thu, 27 Jan 2005 05:41:30 -0800

BTW, is the owner of table Portal_Users dbo? If the owner
is not dbo, you have to name it
titlepost.OwnerName.Portal_Users. The
titlepost..Portal_Users means titlepost.dbo.Portal_Users.

Hope it helps,

Elton Wang
elton_wang@hotmail.com

>-----Original Message-----
>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=abstr
actors"
>Any suggestions are appreciated.
>
>Corbin
>
>.
>



Relevant Pages

  • Re: newbie, querie help/advice
    ... > user3 has read access to both tables. ... First, above query will fail because you qualify the column name with dbo, and you didn't alias the ... Dbo is a user that exists in every database, the database owner. ...
    (microsoft.public.sqlserver.programming)
  • Re: Table OWNER
    ... Wts the query to know the Owner of a table? ... I created a table in the SQL Enterprise Manager and SQL Query Analyser, ... the EM shows the owner of the Table as dbo. ...
    (microsoft.public.sqlserver.security)
  • Re: Object permissions
    ... Who is the owner of the query? ... permissions does the owner have on the underlying tables? ... does the user have on the query; ... to 'owners' in the sql statement each time the code runs, ...
    (microsoft.public.access.security)
  • Re: ADP: Cant use stored procedure on remote SQL server
    ... Not only I use dbo everywhere but I ... If you don't mention the owner when creating a new stored procedure, view, ... BTW in the database window, all the stored procedures are followed by ... Check also the owner of the SPInc stored procedure. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Object permissions
    ... objQDF.SQL= strSQLAttendance with the error about not having necessary ... implicit 'read and modify' permissions on the query. ... If I set up a new query with this user or their group as the owner, ... Especially when this code should work with only the modify permission ...
    (microsoft.public.access.security)