Data Type Question

  • Hi Everyone,

    I have a field which is currently set to varchar(4000), unfortunately this was mis-specified and it turns out that we need to change the data type or limit to allow 10000 characters. The field is used to store blog-style entries which include html code, hence the reason for the large limit. I am using SQL 2005.

    Please can you recommend a datatype that I should use, from reading around I think that either 'varchar(max)' would be ok or possibly 'text' however i have seen reports that the latter is going to be phased out.

    Feel free to correct me if I am wrong and make a suggestion.

    Many Thanks,

    David

  • Varchar(max), definitely. Unless you need non-Latin characters, then NVarchar(max). (That's for things like Chinese characters, Greek letters, etc.)

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • AS suggested varchar(max) is your best choice for large data types, nvarchar(max) if you are willing to use any national/unicode characters.

  • Thanks very much guys, I will proceed with an nvarchar(max) then! 🙂

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

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