Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Multi Database View

  • 05-05-2005 02:54PM
    #1
    Registered Users, Registered Users 2 Posts: 604 ✭✭✭


    Hi,

    I dont know if this is possible, I have a database which contains a table of users that i have updated daily using a DTS job. I want to create views that use this Table rather than creating more than one instance of this table.

    So can i somehow query this table from a different database ? or is that just not possible.


Comments

  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    yes if you are using MS SQL Server
    If the database in running in the same instance of SQL Server
    then its just
    SELECT * From MyOtherDatabase.DBO.MyView

    presuming DBO owns MyView otherwise replace it with the user who owns MyView(although I can never really think of a good reason for having non dbo owners)

    if its running on a different sql server instance you should look at linked servers on SQL Books online


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Like Amen said....

    ...as an additional note, though, you'll want to read up on intra-database security in MSSQL, which is different from version to version. If memory serves, its also changed from service-pack to service-pack as well at time.

    Check the "books online" for Ownership Chaining.

    Course...if you're not implementing security in your databases in the first place (I only say this because I'm constantly staggered at the number of ppl who do stuff like hard-code logins with the 'sa' user into apps)...then this probably won't be an issue :)

    jc


Advertisement