Quantcast
Channel: Recent Edits
Viewing all articles
Browse latest Browse all 12198

Example query could return un-intended results

$
0
0
$0$0 $0$0 $0I see a flaw with the example query.  When joining sys.default_constraints to sys.columns, the example only joins ON parent_column_id = column_id but this causes an issue when there are column_id(s) in sys.columns that overlap the column_ids in the sys.default_constraints values for the given table.  This can be resolved by joining also on d.parent_object_id = c.[object_id]:$0 $0 $0$0 $0SELECT d.definition FROM sys.default_constraints AS dINNER JOIN sys.columns AS cON d.parent

Viewing all articles
Browse latest Browse all 12198

Trending Articles