Changing a record in a table (sql server) that has foreign keys? -


Does anyone know if there is a fast way to edit a record that has a foreign key in the table (in SQL Server). I will explain .. I have around 5 tables that have my own identity, but are linked together using a foreign key ...

So I have foreign keys (contracts in my case Number), but call me each record in a new record Had to drink and had to edit it like this ...

As I try to edit the contract number, it gives me a standard error of affiliation and violates a foreign key

Any thoughts?

Are you talking about changing PK and then updating all the FAQs? Cascade updates will be enabled in that case and it will be done automatically as soon as it is deleted, you can enable Cascade Delayes

DELETE at CASCADE

Specifies that If an attempts are made to delete a line, the other lines in the other table are removed, the keys referenced by the foreign keys, all the lines of those foreign keys are also deleted. If tables are referred, then the target tables are also defined, the specified cascading functions are also taken for the rows removed from those tables.

On an update cassette

Specifies that if an attempt is made to update a significant value in a line, where the other values ​​are referenced to the key values ​​in existing rows All foreign key values ​​are also updated to the new value specified for the key. If extensive referenced works


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -