Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Location
    Orlando,FL
    Posts
    35

    Unanswered: Convert Varchar to number

    Using SQL 2005. I have a field with dollar amounts but field type is VarChar. Need to convert to number to sum. What's the best way to do this or how can I sum a field type Varchar that has dollar amounts. Thank you, David

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    function = cast
    datatype = money
    as in

    Code:
     
    declare @c1 varchar(10), @m1 money
    select @c1 = '123.45'
    select @m1 = cast(@c1 as money)
    select @m1

    -- This is all just a Figment of my Imagination --

  3. #3
    Join Date
    Jul 2007
    Location
    Orlando,FL
    Posts
    35
    Thank you very much. Works great. David

Posting Permissions

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