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

Example query could return un-intended results

$
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 $0SELECT d.definition $0 $0FROM sys.default_constraints AS d$0 $0INNER JOIN sys.columns AS c$0 $0ON d.parent_c

Viewing all articles
Browse latest Browse all 12198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>