Custom Search
Join the PC homebuilding revolution! Read the all-new, FREE 200-page online guide: How to Build Your Own PC!
NOTE: Using robot software to mass-download the site degrades the server and is prohibited. See here for more.
Find The PC Guide helpful? Please consider a donation to The PC Guide Tip Jar. Visa/MC/Paypal accepted.
Results 1 to 8 of 8

Thread: storing numbers

  1. #1

    storing numbers

    can anyone tell me in programming terms what would be the best way to store this number 142FER4645 (payroll number)

    many thanks


  2. #2
    Join Date
    Oct 2001
    Location
    N of the S of Ireland
    Posts
    20,490
    What is best depends on which parts of it you are going to most commonly want to access, manipulate and sort and whether you don't want to "waste" any storage bits.

    If you want to store it as a single entity (or keep it of fixed length and with any numeric parts thus having leading zeros) then you must store it as a text string.

    The left three characters and the right four characters could be saved as numeric integer, single or double values (with each of these using up more memory per value).

    Whether stored as three fields or as one field the constituent parts can be reassembled using all the basic string manipulation techniques.
    Take nice care of yourselves - Paul - ♪ -
    Help to start using BiNG. Some stuff about Boot CDs & Data Recovery Basics & Back-up using Knoppix.

  3. #3

    storing numbers

    i do not need to manipulate the information nor do i need to access it i just need to know by example how anyone would think it best to store the number 142FER4645 (payroll number)

    many thanks


  4. #4
    Join Date
    Jan 2005
    Location
    West Australia
    Posts
    220
    i'd suggest a simple string. it allows for room to expand. i assume it's going to be like a primary key in a database. also what language?

  5. #5
    agreed, use a string (unless you're using sql, then use a varchar).

    Brett

  6. #6

    storing numbers

    the language would be VB mmany thanks for all your help on this one so far



    Andy

  7. #7
    Join Date
    Feb 2005
    Location
    Mid West of England
    Posts
    13
    a BYTE array (stored as ASCII) would use about as many bytes if the length was always fixed, a string in best for an unknown length but needs more thought if you then want to tease-out parts of the value (eg 3rd character). Is it VB or VBA (eg Excel or Access)? because often keeping the value in a visible form (in a cell) is so much easier to fault find. If you are asking the question you must be a novice.

  8. #8
    Join Date
    Aug 2001
    Location
    Land of 10,000 Lakes and Minnesota nice!!
    Posts
    11,058
    If you are asking the question you must be a novice.
    I'm not understanding what point you are trying to make...would you please explain?
    Lighten up! --- A merry heart does good like a medicine. (Proverbs 17:22)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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