sql server - t-sql: What is the best way to compare against decimals -


in query need records percentage less 50%.

the field stores percentage values defined char(3). example, see data defined '.35'

in query used condition where mypercentagevalue < '.50', not work noticed field has values such '85', '95', '90' , etc

would can use compare against cases

thank you

i agree @eugene.it , @jnk if reason (and can't think of one) can't fix data use below.

where .5 > case when cast(mypercentagevalue decimal (6,2)) >= 1 cast(mypercentagevalue decimal (6,2))/100 else cast(mypercentagevalue decimal (6,2)) end 

i following though.

update #temp set mypercentagevalue = case when cast(mypercentagevalue decimal (6,2)) >= 1                                   cast(mypercentagevalue decimal (6,2))/100                                    else cast(mypercentagevalue decimal (6,2)) end 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -