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. 2 DataBases? Yes, 2 DataBases

2 DataBases? Yes, 2 DataBases

Scheduled Pinned Locked Moved Database
databasequestionsysadminannouncement
5 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.
  • A Offline
    A Offline
    andreumv
    wrote on last edited by
    #1

    I wish to know if there is any way to create a trigger that runs when a user makes some insert / update / delete action on a table of a database and then add the same values to a table that dwells in another separate database, both Sql-Server. How can I use the table in the external database? is it possible? Thanks.

    S K 2 Replies Last reply
    0
    • A andreumv

      I wish to know if there is any way to create a trigger that runs when a user makes some insert / update / delete action on a table of a database and then add the same values to a table that dwells in another separate database, both Sql-Server. How can I use the table in the external database? is it possible? Thanks.

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

      hi It is possible, just call the tablename like databasename.dbo.tablename

      k.ravi sankar

      K A 2 Replies Last reply
      0
      • A andreumv

        I wish to know if there is any way to create a trigger that runs when a user makes some insert / update / delete action on a table of a database and then add the same values to a table that dwells in another separate database, both Sql-Server. How can I use the table in the external database? is it possible? Thanks.

        K Offline
        K Offline
        Krish KP
        wrote on last edited by
        #3

        andreumv wrote:

        How can I use the table in the external database?

        does this mean both databases are not in one server. if so, you need to link both using sp_addlinkedserver check online help for syntax and usage. once after linking you can access the tables like <server>.<database>.<owner>.<table> if both databases are on same then <database>.<owner>.<table> I've used both (in queries/functions/procedures) exceipt in triggers

        Regards KP

        1 Reply Last reply
        0
        • S Sankar Komma

          hi It is possible, just call the tablename like databasename.dbo.tablename

          k.ravi sankar

          K Offline
          K Offline
          Krish KP
          wrote on last edited by
          #4

          If the table is not owned by dbo then?

          Regards KP

          1 Reply Last reply
          0
          • S Sankar Komma

            hi It is possible, just call the tablename like databasename.dbo.tablename

            k.ravi sankar

            A Offline
            A Offline
            andreumv
            wrote on last edited by
            #5

            Yay, it worked nice! thanks a lot, mate.

            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