Convert from US dollar to UK pounds

  • I have shopping cart built in US datetime and currency format and I want to change the currency from US dollars to British pound so please someone tell me how I can alter the database so it transform to UK currency?

  • The tough part about this issue is that the difference between US and UK currency changes. How are you going to handle that?

    Anyways, there's two ways to do what you want: (assume the US to UK exchange rate is 1.5)

    1. UPDATE tablename

        SET Cost = Cost * 1.5

    2. Alter the table to add a computed column:

    ALTER tablename ADD UKCost AS Cost * 1.5

    I like the second method as it keeps the original value for future use.

    Good luck...whichever way you choose make sure you test it first.

    -SQLBill

  • I ment I want when i enter the prices in pounds and also to be displayed in pounds like £12021 and so on not in $12021 I managed to change the datetime to UK format but the currency still display with the $ how to change that?

  • Is this what you're looking for???

    declare @char nvarchar(10)

    set @char = '$10.00'

    print @char

    select @char = replace(@char, '$', nchar(163))

    print @char

    --Steve

  • If you are using a MONEY or SMALLMONEY currency data type in the database, it depends on your Locale / Region settings in the application.

    For a ASP / ASP.Net application, you can leave your code page as Unicode (UTF-8) and change your locale to Britain. Magically any currency outputs will then be in Pounds.

    ASP / VBScript also has a FormatCurrency function which will (if I remember correctly) supports  locale. So again, set your locale beford writing the output and you should be fine.

    J


    Julian Kuiters
    juliankuiters.id.au

  • Go to the Books OnLine, use the Index tab and enter Currency. Then double click on Data Types under currency. Select the option Using Monetary Data.

    Hope that helps you,

    -SQLBill

    BOL=Books OnLine=Microsoft SQL Server's HELP

    Installed as part of the Client Tools

    Found at Start>Programs>Microsoft SQL Server>Books OnLine

  • ****Edited by Steve Jones*****

    The previous comment was unprofessional and I have removed it.

    Steve Jones

    ****Edited by Steve Jones****

  • I am not english speaker and english language is my third language so that is not the point we talking about programming langauge in here not grammer or spelling.

  • I managed to fix the problem by making the change on my code not in the database (ASP.NET), I used the culture=(en-UK) and also the uiCulture=(en-UK) and that made the trick

    thanks alot guys

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply