Regular Expressions 101

Community Patterns

sql default constraints

0

Regular Expression
PCRE (PHP <7.3)

/
IF NOT EXISTS \(SELECT \* FROM sys\.objects WHERE object_id = OBJECT_ID\(N'\[(.*?)\]\.\[(.*?)\]'\) AND type = 'D'\) BEGIN ALTER TABLE \[(.*?)\]\.\[(.*?)\] ADD DEFAULT \(\((.*?)\)\) FOR \[(.*?)\]
/
gm

Description

Search in sql script generated using SCA for the implicit constraint names and defining the name explicityly

Submitted by anonymous - 5 years ago