문제

I have a large database and I didn't add cascade on update/delete.

Can we do it with T-SQL without deleting and then recreating all the FK objects?

도움이 되었습니까?

해결책

You should drop and recreate foreign keys. this is the only way. but you can use sys.foreign_keys and sys.foreign_key_columns to get the FK name and columns. then you can write a loop to fetch names and columns and drop an recreate it with cascade option in every time loop executed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top