Results 1 to 5 of 5

Thread: Sql Code Query

  1. #1
    Join Date
    Jun 2005

    Unanswered: Sql Code Query

    Forgive me if i'm being really stupid but... we have an accounts package (Exchequer) using sql. I would like to use the tables in sql to interrogate the db further. However my numeric fields e.g. Credit Limit are split into 2 fields. One is a smallint type and one is an integer. How do I combine these fields to get an accurate value?

  2. #2
    Join Date
    Nov 2004
    on the wrong server
    Provided Answers: 6
    they should implicitly convert when you do a FieldA + FieldB, but if they do not use a Cast and do the Cast to the larger more accurate data type.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Jun 2005
    thanks sean,

    Maybe a bit more explanation would help...
    the credit limit field is split into 2
    In sql the values read:
    credlim_1's value : 138
    credlim_2's value : 2046820352

    but if you look at the actual database the credit limit for this is £1,000.
    I'm a bit new to all this cast command and would really appreciate your help

  4. #4
    Join Date
    Apr 2002
    Toronto, Canada
    i'm gonna guess that one of the two fields is a code for the currency (pounds, in this case) and the other is the value

    although how you get 1000 out of 2046820352 is anybody's guess

    looks like you'll need to dig up more information... | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jun 2005
    Sorry but i can't seem to find any logic behind this. Here is a couple of examples:
    Currency Credlim_1 Credlim_2 Actual Credit Limit
    Stg 141 2046820352 8,000
    Stg 138 2046820352 1,000
    Eur 141 998244352 6,000
    Stg 141 1522532352 7,000

Posting Permissions

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