Keeping the zeroes when converting varchar to float in SQL Server -
is there way keep preceding zeros when converting varchar float in sql server select query ?
declare @data varchar(100) = '000.1234';
when convert @data float, 0.1234 only.
but how keep full zeroes after converting varchar float 000.1234 [ie, without trimming zeroes]
sometimes @data may '00.23'
even though, has keep ever preceding zeroes after conversion.
floating-point numbers stored physically in format not preserve leading zeroes (as not affect actual value being stored).
so keep value in varchar preserve formatting, or have separate field stores how many leading zeroes need when formatting number.
Comments
Post a Comment