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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. can we set foreign key from another database

can we set foreign key from another database

Scheduled Pinned Locked Moved Database
helpdatabase
2 Posts 2 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.
  • B Offline
    B Offline
    BSRK
    wrote on last edited by
    #1

    here is my problem, please help. I am having 2 databases namely employees and projects. employees database contains a table emp (with fields like empname, etc). projects database contains a table prj (with fields like prjname, prj_leader, etc). but i want to ensure that ALL the prj_leader entries MUST be existing empnames of emp table in employees database. i know that if both the tables are in the same database, it is simple. but i have no idea whether we can set such foreign key constraints across databases. kindly suggest.

    N 1 Reply Last reply
    0
    • B BSRK

      here is my problem, please help. I am having 2 databases namely employees and projects. employees database contains a table emp (with fields like empname, etc). projects database contains a table prj (with fields like prjname, prj_leader, etc). but i want to ensure that ALL the prj_leader entries MUST be existing empnames of emp table in employees database. i know that if both the tables are in the same database, it is simple. but i have no idea whether we can set such foreign key constraints across databases. kindly suggest.

      N Offline
      N Offline
      Nazmul Hassan
      wrote on last edited by
      #2

      I’m afraid, its not possible. But,you can use Procedure to ensure this. With regards, Nazmul Hassan Hirok

      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