[AccessD] [dba-SQLServer] Using view or sp from other Db on same Instance of Server

Borge Hansen pcs.accessd at gmail.com
Sat Feb 5 03:22:06 CST 2011


Yes, I am referencing the Db.
I have created viewDb1 in Db2.
The view executes ok in Db2
When I try and use viewDb1 in a join in another select SP in Db2  I
can create and save the SP but it will not execute. It does not
recognize the viwDb1.
??
I will now create the ViewDb1 in Db1 and on the SP in question in Db2
try and join up the Db1.viewDb1 ... We'll see.
Thanks for the input.
borge

On Saturday, February 5, 2011, Paul Hartland
<paul.hartland at googlemail.com> wrote:
> Have you got an example of the view and SP, if you want to run a view or SP
> in DB2 that uses tables/views in DB1 then you have to reference the database
> (which I am assuming that you are doing), but if not example is below:
>
> in DB1 you have a view call it say ViewInDB1, to reference the view in DB1
> from DB2 you would use something like SELECT * FROM DB1.dbo.ViewInDB1
>
> Paul
>
> On 5 February 2011 08:14, Borge Hansen <pcs.accessd at gmail.com> wrote:
>
>> Hi all,
>> I have created both a view and a SP based on tables in another Db
>> (call it Db1) on the same instance of the SQL Server (2008). I created
>> the view and SP in say Db2. A simple Select ...
>> When I want to use either the View or the SP in a join with other
>> tables in Db2 I am stuck. The SP containing the join to either view or
>> SP based on Db1 tables and saved in Db2 will save Ok but not execute.
>> Both the view and the SP that I am trying to join up will execute ok
>> when running on their own.
>> Funny thing is that in the Access FE I can create a pass through query
>> based on the view and join the pass through query to an odbc linked
>> table from Db2.
>> Any one who can shed light on this?
>> borge
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>
>
>
> --
> Paul Hartland
> paul.hartland at googlemail.com
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list