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. convert varchar to bigint

convert varchar to bigint

Scheduled Pinned Locked Moved Database
questiondatabasemysql
3 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.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    how can I convert a varchar like this "254565825145" to bigint in mysql stored procedure?

    P 1 Reply Last reply
    0
    • J Jassim Rahma

      how can I convert a varchar like this "254565825145" to bigint in mysql stored procedure?

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

      Try:

      select cast('254565825145' as unsigned)

      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      P 1 Reply Last reply
      0
      • P Pete OHanlon

        Try:

        select cast('254565825145' as unsigned)

        I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

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

        What if it's in hex? :-D At a previous job of mine, the company stored 64-bit IDs in strings as hex (in RDB*) and there was no native way of converting them back and forth within the database, you had to fetch the data out and then work on it (in C). Eventually I wrote functions (like CLR extended stored procedures in SQL server) to do it. * Which still doesn't support 64-bit integers?

        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