Still Confused about the difference between varchar(max) and varchar(8000)

  • Can you tell us a little about your database? Is it something you are in the process of constructing or is it something you have inherited? What is the purpose? What types of data are you storing? There may be a business case for having all columns VARCHAR(MAX) but it's very unlikely.

    I'm just constructing it, and I have already taken into consideration the suggestions of the two gents who earlier replied to this thread, I'm just confused on why do we need to use VARCHAR(50) instead of VARCHAR(MAX) and their replies satisfied me. Well, any more ideas is greatly appreciated!

  • joshua 15769 (8/18/2016)


    Can you tell us a little about your database? Is it something you are in the process of constructing or is it something you have inherited? What is the purpose? What types of data are you storing? There may be a business case for having all columns VARCHAR(MAX) but it's very unlikely.

    I'm just constructing it, and I have already taken into consideration the suggestions of the two gents who earlier replied to this thread, I'm just confused on why do we need to use VARCHAR(50) instead of VARCHAR(MAX) and their replies satisfied me. Well, any more ideas is greatly appreciated!

    Remember to use the adequate date/time data types instead of using strings or integers. Also, use numeric data types when appropriate (FYI, telephones and zip codes are not numeric data). Avoid storing formatted strings. Those are some of the most common mistakes I see.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Also, use numeric data types when appropriate (FYI, telephones and zip codes are not numeric data).

    Social Security numbers are also not numeric. Once had a discussion with a programmer who told me that if they could be integers that they'd perform better. The discussion ended when I pointed out that many SSNs begin with one or more zeros.

  • RonKyle (8/19/2016)


    Also, use numeric data types when appropriate (FYI, telephones and zip codes are not numeric data).

    Social Security numbers are also not numeric. Once had a discussion with a programmer who told me that if they could be integers that they'd perform better. The discussion ended when I pointed out that many SSNs begin with one or more zeros.

    The next part of the discussion should have been around the encryption of SSNs. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • The next part of the discussion should have been around the encryption of SSNs.

    We were designing for a SQL 7 database (this was in the late 90s) and I was also primarily a programmer at that time. It might not have even been possible given the version, but if it was I was too new and too much an accidental DBA at the time to know better.

  • Jeff Moden (8/22/2016)


    RonKyle (8/19/2016)


    Also, use numeric data types when appropriate (FYI, telephones and zip codes are not numeric data).

    Social Security numbers are also not numeric. Once had a discussion with a programmer who told me that if they could be integers that they'd perform better. The discussion ended when I pointed out that many SSNs begin with one or more zeros.

    The next part of the discussion should have been around the encryption of SSNs. 😉

    That's the reason of why I didn't include them in the examples. 🙂

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • That's the reason of why I didn't include them in the examples

    I see your point now. You're right.

Viewing 7 posts - 16 through 21 (of 21 total)

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