define varchardatatype

  • hello friends

    is any different between this kind of declaration for Table field :

    [Name] varchar(100) or [Name] varchar(1000)

    consider Name length will not be more than 50 characters !

  • You might want to read this article:

    http://support.microsoft.com/kb/154886

    for how varchar values are stored. It also contains very simple sample code so that you can test and view the results of the ANSI_Padding settings. With this understanding I assume you can answer your own question.

    Then read this article so as to prepare for the future, i.e., potential future upgrades.

    http://technet.microsoft.com/en-us/library/ms187403.aspx

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • bitbucket (12/6/2008)


    You might want to read this article:

    http://support.microsoft.com/kb/154886

    for how varchar values are stored. It also contains very simple sample code so that you can test and view the results of the ANSI_Padding settings. With this understanding I assume you can answer your own question.

    Then read this article so as to prepare for the future, i.e., potential future upgrades.

    http://technet.microsoft.com/en-us/library/ms187403.aspx

    Thanks,i read the article.

    i have a question?could we say use varchar instead char in everywhere or using char has benefit ?

  • The answer like most answers to SQL questions is "That depends"

    These 2 BOL pages should give you the guidance you need for your databases.

    1. To understand the effect of ANSI_Padding setting

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/07cc67f6-5057-463b-8975-694a5b484926.htm

    2. Microsoft makes the following recommendations

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/282cd982-f4fb-4b22-b2df-9e8478f13f6a.htm.

    It basically boils down to:

    Use char when the sizes of the column data entries are consistent.

    Use varchar when the sizes of the column data entries vary considerably.

    Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

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