Hi @Jin Ka
I want to Set the FK Columns to ON DELETE SET NULL in Only (for Example) any Schema name starting with 'Store'
How about add a filter in the where clause, like this:
where (sys.objects.[type] = 'U')
and (sys.objects.[name] not in ('sysdiagrams'))
and schema_name(sys.objects.schema_id) like 'Store%'
work for both Single & Multiple Columns
Refer to the second answer by Ed Avis in this thread: SQL Script to alter ALL Foreign Keys to add ON DELETE CASCADE
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.