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

Paul Hartland paul.hartland at googlemail.com
Sat Feb 5 02:56:51 CST 2011


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



More information about the AccessD mailing list