dcsimg
Results 1 to 2 of 2

Thread: Table Contents Modification

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    Table Contents Modification

    I would like to modify a
    varchar column (currency_varchar) in a
    table (currency_Conversion)

    example current values in column
    $32.15
    0.15
    98.85
    43215
    6,644,232,121.42

    Goal
    Remove $ & Commas but leave other values alone.

    Example pieces of code

    update currency_conversion
    set currency_varchar = cast (cast (currency_varchar as money)as varchar)
    select * from currency_conversion
    where substring (currency_varchar from 1 for 1) = '$' ;


    or maybe

    declare temp_table table (
    temp_varchar varchar (30))
    insert into temp_table select currency_varchar from currency_conversion
    where substring (currency_varchar, 1,1) = '$'

    update currency_conversion
    set currency_varchar = cast (cast (temp_varchar as money)as varchar)

    Let me know, i have done it in MSSQL but need to do it in

    Mandrake Linux 9.1
    Kernel version 2.4
    Linux Postgres Sql version 7.3.2

  2. #2
    Join Date
    Feb 2006
    Posts
    1
    Try using the regular expression functions.
    Sorry but im still new to postgresql, so i cant give you a working example right now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •