What are the challenges you face when working across database platforms? Take the survey

Foreign keys only by specific attribute

Hello I want generate in the table foreign keys but  in original table this rows have column activate (true/false) and I want foreign key from this table only with activate=true
Is it any way how do this ?
The data from original table are generated too.



  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi @Tom1555 ,

    Thanks for you post!

    Just to make sure I'm understanding correctly what you're hoping to do - can you please provide more detail, perhaps the schema of your table as well as an example of what the data should look like?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

  • Options
    davehortondavehorton Posts: 1 New member
    I needed this too, and did it by using the generic SQL Statement generator. That has the disadvantage of needing an explicit connection, I do not know why it does not default to "current DB" but there it is... 
    For example, I use this query: SELECT ID FROM DBO.FK_TABLE WHERE ACTIVATE = TRUE

    The problem I ran into was having to manually hack the config file when I wanted to populate different DB on a different server... but hopefully this does what you need...

    Good Luck!
Sign In or Register to comment.