Using float and like
-
Hi, Can the following be used in a stored procedure? convert(float, (columnname))like @x I've tried it. It works. Wanted to know if it's a good way of programming? Cheers Berba
As you will be converting the value of each item in columnname to
float
, this is a more expensive operation than converting the value in@x
into the appropriate type.*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
As you will be converting the value of each item in columnname to
float
, this is a more expensive operation than converting the value in@x
into the appropriate type.*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
And then they're converted to string, which is worse. :doh:
-
Hi, Can the following be used in a stored procedure? convert(float, (columnname))like @x I've tried it. It works. Wanted to know if it's a good way of programming? Cheers Berba
berba wrote:
if it's a good
Most likely not; all those conversions will kill you. What are you trying to do? Perhaps you want
BETWEEN
? As mentioned, converting the parameter value (once) is much better* than converting all the values in the column. * Anecdote: I once inherited maintenance of a batch program that took forty minutes to run; after fixing the conversions it took only ten minutes.