what size should i set on the comment column

  • Yes, i did.

    I read

    http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix.html

    and

    http://msdn.microsoft.com/en-us/library/aa933104(v=sql.80).aspx

    and

    http://msdn.microsoft.com/en-us/library/aa276823(v=sql.80).aspx

    it is not the first time i look for the answer. but its the 1st time i ask ppl.

    yes, i dont understand the "var" part in varchar. thank you telling the answer.

    but why we still have to set up the size for the variable

  • Well, really you are defining the limits of the column. It should be defined to that number that will be a limit based on the application design.

    So you have a limit to how much data can be in a row and while the definition of the row can exceed 8060 bytes (the limit of data that can fit on a page), the amount of data stored on that page cannot exceed the 8060 bytes.

    So definition means a lot in the limits of SQL tables, but in this case you are asking what size you should make the comment column.

    The answer is that you should limit the number of characters to the number that makes sense for the application. In some cases people want to put a lot of text and the application allows to put in up to 2 GB of data, so they make it the type 'text' in SQL 2000 and below, and varchar(max) in 2005 and above.

    But in this case, if nvarchar(200) is not large enough, then you should consider a higher number, but the size should be decided based on the application and the person that is closest to it is you.

    I think we explained the difference between nvarchar and varchar and you now know the storage ramifications, so do you have enough from us to move you along?

    If not, please let us know what you need.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • yes, you answered the question completely. thank you.

    the reason i asked this, buz the table will go large, "IF" i set the size large, and waste it, then slow down the preformance, that i dont want it to happen.

    now, i will not have this idea. thx!

    quick related question, the table got 70000rows, if i use alter table, change from nvarchar(200) to varchar(1500), is the data will gone?

  • The data will not be gone. It will expand the definition in the header of the table and convert the data from nvarchar to varchar, but the data will not be gone.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

Viewing 4 posts - 16 through 18 (of 18 total)

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