Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Decimal ?

  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,960
    Thanks
    120
    Thanked 76 Times in 76 Posts

    Decimal ?

    Code:
    select 
    
    right(lat,1),
    case when right(lat,1)='S' then
    CAST(SUBSTRING_INDEX(Replace(Replace(lat,'N',''),'S',''),' ',1) AS DECIMAL) +
    CAST(SUBSTRING_INDEX(Replace(Replace(lat,'N',''),'S',''),' ',-1) AS DECIMAL)*100/60/100
    else
    CAST(SUBSTRING_INDEX(Replace(Replace(lat,'N',''),'S',''),' ',1) AS DECIMAL) +
    CAST(SUBSTRING_INDEX(Replace(Replace(lat,'N',''),'S',''),' ',-1) AS DECIMAL)*100/60/100*(-1)
    end
    as lat_wgs
    from _dump_climatological_data_view
    group by station,state
    order by state,station
    sample output:

    "S","66.65000000"
    "N","12.86666667"
    Why there is no negative infront of "N" line data ?
    Last edited by BubikolRamios; 12-15-2013 at 03:35 PM.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Decimal is simple 0 - 9 numbers..


  •  

    Posting Permissions

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