Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Using float and like

Using float and like

Scheduled Pinned Locked Moved Database
databasequestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    berba
    wrote on last edited by
    #1

    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

    P P 2 Replies Last reply
    0
    • B berba

      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

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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

      P 1 Reply Last reply
      0
      • P Pete OHanlon

        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

        P Online
        P Online
        PIEBALDconsult
        wrote on last edited by
        #3

        And then they're converted to string, which is worse. :doh:

        1 Reply Last reply
        0
        • B berba

          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

          P Online
          P Online
          PIEBALDconsult
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups