sethreno / schemazen

Script and create SQL Server objects quickly
MIT License
333 stars 140 forks source link

Fix cast-tostring-Exception with Default Value on Column Type bit #126

Closed aka512 closed 7 years ago

aka512 commented 7 years ago

Default to 0. Otherwise this may produce DB.Null (on column type bit with a default value) that can not be cast to string on Line 701.

sethreno commented 7 years ago

This doesn't seem like the correct way to fix this bug. If sys.default_constraints.definition is null then it should stay null. This changes it to 0 which assumes the type is numeric or a bit.