Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to access a table in sql2005 database from stored procedure in another database

How to access a table in sql2005 database from stored procedure in another database

Scheduled Pinned Locked Moved Database
databasehelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shaimmaa
    wrote on last edited by
    #1

    Hi here is what I have 1- I have 2 different tables in 2 different databases 2- I need to write a stored procedure to start a transaction to add data in both tables so if any error occured then rollback so I want to access the table in the other database to add data to it any help thanks Shaimmaa

    S 1 Reply Last reply
    0
    • S Shaimmaa

      Hi here is what I have 1- I have 2 different tables in 2 different databases 2- I need to write a stored procedure to start a transaction to add data in both tables so if any error occured then rollback so I want to access the table in the other database to add data to it any help thanks Shaimmaa

      S Offline
      S Offline
      Sankar Komma
      wrote on last edited by
      #2

      Get the data from one database table to anothter databse select * from databasename.dbo.tablename

      smile :-)

      M 1 Reply Last reply
      0
      • S Sankar Komma

        Get the data from one database table to anothter databse select * from databasename.dbo.tablename

        smile :-)

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Assumes the DBs are on the same server (valid assumprion from the ?) If the DBs are on different servers you will need to look into Linked servers (nasty things linked servers)

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups