This is on SQL Server 2008.
I have several columns I want to convert from money
and decimal
to varchar
, for example a column called item_amount
.
How will these values be converted?
Will it be the same as
convert(varchar, item_amount)
? Running a query likeselect item_amount, convert(varchar, item_amount) from <table>
renders the columns identically, which is what I would expect and want.I should be safe from possible truncation, correct?
Assuming there are enough characters in the
varchar
column (which would be 39, since the max precision for a decimal column is 38 + 1 character for the decimal point). None of the numeric values are even close to 38 digits, most in the 3-5 range.I've run this command successfully on a test table and want to make sure I'm not overlooking or forgetting something that's going to screw me:
alter table <mytable> alter column item_amount varchar(39) default '0'
(this is after droping the existing default ((0)) constraint).