REPLACE statement removing commas from a money convert... I do NOT want it to do this

I am using a case statement to remove the '-' from a negative number and place a '(' there instead. 
The negative side of the CASE statement is as follows:
REPLACE(CONVERT(varchar, CONVERT(money, SUM(Begin_Balance)), 1), '-', '(') + ')'
The positive side is:
CONVERT(varchar, CONVERT(money, SUM(Begin_Balance)), 1)
The data output for the positive portion is 100% correct. Here is an example of the output I receive.
(18271.15)
(25000.00)
82,490.00
45,000.00
Why is the replace statement stripping my commas?

>> I am using a case statement to remove the '-' from a negative number and place a '(' there instead. <<
So many horrible fundamental errors in one sentence! 
1.  CASE is an expression, not a statement. An expression returns a scalar value of a known data type, A statement changes the schema. 
2. In SQL, all display formatting is done in a presentation layer, never in the database.
3. We use the ANSI/ISO Standard  CAST()  and not the old Sybase/Unix CONVERT today
4. We use DECIMAL() and not the old Sybase/Unix MONEY. This thing does not work; it fail to do correct math; Google it! Do a data audit and see if you can go to jail for this. 
5. SQL is not COBOL. The COBOL language treats all data as strings. STOP DOING THAT IN SQL! This language uses abstraction in the database and the presentation does the job that your old PICTURE clause used to do. 
Can you get a 2-3 week intro course to SQL and modern programming form your company? 
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • Removing commas from report result

    Hello gurus,
    Is there a way to remove commas from data values in the BEx reports?
    I used NODIM() to remove $ signs and units. We need to remove the commas as well.
    Thank you,
    Malli

    hi,
    in query properities you should have option to show unit on the top of column only and in key figure properities should be option to choose how many decimal spaces you want to be visible on report (this option you have in rsa1 -> infoobjects -> your key figure -> BEx reporting tab)
    Regards,
    Andrzej

  • How can I remove photos from iPhone...when I synced to another computer, it loaded up a ton a pictures from the laptop that I did not want on my phone

    Help!  I have 4 different computers that I plug my iPhone 4 into from time to time.  I just synced it with a laptop that I haven't plugged into for a long while, and it overloaded my phone with a ton of pictures from the computer that I did not want or need on my phone.  When I went to PHOTOS on my iTunes, and checked "sync checked folders only", it says it will replace the photos on my phone.  I'm not sure this is what I want...I don't want to lose the photos on my phone.  I have over 3000 on there!

    You can sync photos and itunes content with one and only one computer at a time.  When you sync to another, it will erase the current content and  replace with content from the new computer.

  • HT201272 I removed Netflix from my iPad last year. I want to reuse it now but am unable to download it off iCloud. It isn't getting highlighted. What should I do?

    I removed Netflix from my iPad last year. I want to reuse it now but am unable to download it off iCloud. It isn't getting highlighted. What should I do?

    Use the serial number found in Settings > General > About
    Key it in here:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do
    Edit:
    I've done it for you: It's iPhone 3G and not iPhone 3GS.
    Message was edited by: ckuan

  • How do I remove all traces of  'album'? I do not want artwork, blank place holders, titles or artists sorted by album? I just want my music listed by title, artist or genre.

    How do I remove all traces of  'album'? I do not want artwork, blank place holders, titles or artists sorted by album? I just want my music listed by title, artist or genre.

    1, you can't at the moment, though with iOS 5 in the Autumn, from http://www.apple.com/ios/ios5/features.html#photos :
    Even organize your photos in albums — right on your device
    2, by removing it from you synced from and re-syncing. Only photos taken with the iPad, copied to it via the camera connection kit, or saved from emails/websites etc can be deleted directly on the iPad (either via the trashcan icon in the top right corner if viewing the photo in full screen, or via the icon of the box with the arrow coming out of it in thumbnail view)
    3, the location of the photos that you synced to the iPad should be listed on the iPad's Photos tab when connected to your computer's iTunes.
    4, you can copy the photos from your iPad to your computer : http://support.apple.com/kb/HT4083 . You should also be able to delete them from the iPad as part of the transfer process to your computer, and it's then your choice whether to add them to your sync photo list so as to copy them back to the iPad. Copying them to your computer would allow you to organise them into folders and therefore be able to sync them back into separate albums.
    5, I don't use Dropbox either. There are some third-party browser apps in the iTunes App Store that allow you to download pages so that you can view them when offline e.g. Atomic Web (the whole page is saved within Atomic Web, it doesn't place a photo into the Photos app)
    6, deleting content should help. If you remove an app from your iPad then you also remove the content that it's got on the iPad - so if you then decide to reinstall it back onto the iPad then you will need to manually add back any content that you want in it. None of the Apple built-in apps (including Photos) can be removed from the iPad

  • I added an e-mail account to my iphone using microsoft exchange; all went fine. I then deleted a number of contracts from my phone that I did not want there and find they are now gone from my e-mail account on my computer.  Can I retrieve them?

    I added an e-mail account to my iphone using microsoft exchange; all went fine. I then deleted a number of contacts from my iphone that I did not want on my phone. when I went into my e-mail account on my computer the contacts were deleted from there also.  Will I be able to retrieve them?  If so, how?  Thank you.

    In the device sync pages select Photos on the top at the right.
    Un tick Sync Photos
    Apply

  • I am unable to update to IOS5 from Itunes, says "mobile device services not started". What is this and how do I fix it?

    I am unable to update to IOS5 from Itunes, says "mobile device services not started". What is this and how do I fix it?

    Here is a YouTube video which should guide you through a solution:  http://www.youtube.com/watch?v=VLFAo-FWLxE

  • I want to upgrade from iOS 6 to iOS 7.  I do not want 8.  Is this possible?

    I want to upgrade from iOS 6 to iOS 7.  I do not want 8.  Is this possible?

    swbookeesue wrote:
    I want to upgrade from iOS 6 to iOS 7.  I do not want 8.  Is this possible?
    What prevented you from updating to iOS 7 for the previous 12 months?

  • Removing comma (,) from string

    Hello Friends,
    I have a string something of this nature
    Sting : ',3456,45454,,45454,'
    Need to have just comma seperated value : '3456,45454,45454'
    Tried with replace but getting - '34564545445454'
    select replace ( ltrim(RTRIM(replace(',3456,45454,,45454,', ',,', ','),',')),',', '') from dual;
    Appreciate your help .
    Thanks/Kumar

    Hi, Kumar,
    kumar73 wrote:
    Hello Friends,
    I have a string something of this nature
    Sting : ',3456,45454,,45454,'
    Need to have just comma seperated value : '3456,45454,45454'
    Tried with replace but getting - '34564545445454'
    select replace ( ltrim(RTRIM(replace(',3456,45454,,45454,', ',,', ','),',')),',', '') from dual;Do you want to remove ','s at the beginning of the string, but leave them in the other places?
    If so:
    LTRIM (string, ',')LTRIM removes the given character(s) from the <b>L</b>eft side (that is, the beginning) of string. That's all you want here. (Was your string generated by SYS_CONNECT_BY_PATH? This is a very common problem.)
    RTRIM removes the given character(s) from the <b>R</b>ight side (that is, the end) of string. I don't think you want that; you certainly don;'t need it in the example you gave.
    REPLACE removes the given characters anywhere in the string. You definitely don't want that. If you did, there would be no point in also using LTRIM or RTRIM.

  • Removing commas from on address line!!

    I need to remove comma's from an address field:
    substr(s_claim_periods.latest_prop_addr(CLAIMS.cla_refno),1,255) AS D,
    i have tried my usual method of
    translate (CONTACT_ADDRESS, ',' ,' ')
    but im having problems incorporating it with the substr command!!

    you could also use replace
    replace (adr, ',')as in
    SQL> with test as
      2  (select 'address,address,address,address,address' adr from dual
      3  )
      4  -- End of Testdata; here is the actual query:
      5  select adr
      6       , replace (adr, ',')
      7    from test
      8  /
    ADR                                     REPLACE(ADR,',')
    address,address,address,address,address addressaddressaddressaddressaddress

  • Replace Function removing Zero from the end.

    Hi ALL,
    I'm runing following query
    select REPLACE(52000.50,'.') from dualwhich is giving me output as
    *520005*
    But I need last zero also in the output. like *5200050*
    Please help me if you have any solution.

    user2988171 wrote:
    Thanks it worked only small chane in the above query..
    select REPLACE(to_char('52000.50','999999.99'),'.') from dual Edited by: user2988171 on Jul 30, 2010 4:38 PMYou broke it again.
    If you have a string and not a number right from the beginning then there is no reason to use TO_CHAR.
    Simply run
    select REPLACE('52000.50','.') from dual;Or use the correct version from Toon if you enter a number value.
    Btw. If it is a number you could also simply muliply it by 100.
    select 52000.50 * 100 from dual;Edited by: Sven W. on Jul 30, 2010 2:58 PM

  • How can I remove icloud from my iphone as I don't want my whole mailbox on it?

    Is it possible to only receive email without having my whole mailbox downloaded?  If not, how do I remove icloud from my devices?

    Create a new ID for yourself.
    Of course that will have none of your items purchase in the old ID.
    Once you have an ID then log into that ID on the iPhone.
    Allan

  • Firefox is causing problems with facebook I want to remove mozilla from my pc but it will not remove

    I'm having alot of trouble with facebook which I didn't have before Mozilla was installed I want to remove it from my pc but will not remove,Why?

    The following article shows how to remove Firefox if the uninstaller does not work - http://kb.mozillazine.org/Uninstalling_Firefox

  • Hi i removed cydia from my iphone 4s but its not turning on, hi i removed cydia from my iphone 4s but its not turning on

    hello i have remover cydia from my iphone 4s but i think due to that i have removed some important file cause during uninstalling cydia my phone stucked and when i turned it off.then i found that my phone was not turning on even its not working with itunes.can any one help me through out???

    Sorry... But...
    The discussion of Jailbroken Devices is against the Terms of Use of this Forum.
    http://support.apple.com/kb/HT3743
    You will need to look elsewhere.

  • How to I delete all contact on my iPhone at once. These are contacts ABOVE the contact folder that says From My Mac. I do not want to erase all of the other settings and content from my iPhone -- just the contacts.

    How to I delete all contact on my iPhone at once? These are contacts ABOVE the contact folder that says, "From My Mac."
    Someone said create a new empty folder on the computer and sync to that -- didn't work .
    Another person said, "Reset information in settings to restore to the default." That would erase ALL of the conetent I have on the phone and I do not want to erase all of the other settings and content from my iPhone -- just the contacts.
    There has to be a better way than gong through and deleting one-by-one.

    Go into Settings...Mail, Calendar and Contacts and siwtch off the Contacts section from the account in question.
    The phone should ask you if you want to keep or erase the contacts stored on you phone.
    However, if they aren't synched to anything and only exist on your iPhone, you'll have to delete them all one by one

Maybe you are looking for