foreign key w/o constraint

  • Is there a way to create a foreign key w/o the constaint portion in sql server?

  • you could create it WITH NO CHECK so it does not validate the existing data, and would be untrusted...but why would you want to do that?

    referential integrity is a good thing.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • There's certainly nothing stopping you from using columns in one able to reference another table without making it an official foreign key. You would just have to rely on your application to maintain it as opposed to the database engine which may or may not be what you want.

  • ZZartin (1/10/2017)


    There's certainly nothing stopping you from using columns in one able to reference another table without making it an official foreign key. You would just have to rely on your application to maintain it as opposed to the database engine which may or may not be what you want.

    And keep fixing the data over and over again when the application is not able to maintain the data integrity.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (1/10/2017)


    ZZartin (1/10/2017)


    There's certainly nothing stopping you from using columns in one able to reference another table without making it an official foreign key. You would just have to rely on your application to maintain it as opposed to the database engine which may or may not be what you want.

    And keep fixing the data over and over again when the application is not able to maintain the data integrity.

    No one would ever do that, would they? :hehe:

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply