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. How to remove a 1000 seperator from a number

How to remove a 1000 seperator from a number

Scheduled Pinned Locked Moved Database
helptutorialquestion
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.
  • A Offline
    A Offline
    Ambertje
    wrote on last edited by
    #1

    Hello everyone, I would like to know if there is a function that can get rid of a 1000 seperator. My Source data looks like this 1.676 3.349 109 58 70 1.887 I would like it to be like this: 1676 3349 109 58 70 1887 Does anyone know how I can fix this in my following statement please?

    , CASE COALESCE(SHIPPED\_VAL\_MONTH, '') WHEN '' THEN 0 ELSE CAST(SHIPPED\_VAL\_MONTH as decimal(18,2)) END AS SHIPPED\_VAL\_MONTH
    

    Kind regards,Ambertje

    J 1 Reply Last reply
    0
    • A Ambertje

      Hello everyone, I would like to know if there is a function that can get rid of a 1000 seperator. My Source data looks like this 1.676 3.349 109 58 70 1.887 I would like it to be like this: 1676 3349 109 58 70 1887 Does anyone know how I can fix this in my following statement please?

      , CASE COALESCE(SHIPPED\_VAL\_MONTH, '') WHEN '' THEN 0 ELSE CAST(SHIPPED\_VAL\_MONTH as decimal(18,2)) END AS SHIPPED\_VAL\_MONTH
      

      Kind regards,Ambertje

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #2

      From sqlservercentral. Create a UDF and put this in it:

      WHILE PATINDEX('%[^0-9]%',@string) <> 0
      SET @string = STUFF(@string,PATINDEX('%[^0-9]%',@string),1,'')
      SELECT @string

      Wrong is evil and must be defeated. - Jeff Ello

      A 1 Reply Last reply
      0
      • J Jorgen Andersson

        From sqlservercentral. Create a UDF and put this in it:

        WHILE PATINDEX('%[^0-9]%',@string) <> 0
        SET @string = STUFF(@string,PATINDEX('%[^0-9]%',@string),1,'')
        SELECT @string

        Wrong is evil and must be defeated. - Jeff Ello

        A Offline
        A Offline
        Ambertje
        wrote on last edited by
        #3

        Hello Jörgen, Can you help me to create such a User defined function for my case please? I have little experiece with writing functions. Kind regards, Ambertje

        M 1 Reply Last reply
        0
        • A Ambertje

          Hello Jörgen, Can you help me to create such a User defined function for my case please? I have little experiece with writing functions. Kind regards, Ambertje

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          You are going to get better value out of an article than a forum post, there is even one from CP in these results[^]

          Ambertje wrote:

          help me to create such a User defined function

          That is not how the site works, we help you to learn how to create the functions, there are other sites that will do the job for you.

          Never underestimate the power of human stupidity RAH

          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