Maximum row size in SQL Server 2000.

  • Dear All,

    I do work in SQL server 2005.

    Today I happen to add a table in SQL Server 2000 for one of my collegue. In query analyzer, I was trying to create a table with 7 fields out of which 2 fields are of VARCHAR(8000). Even though table got created it gave a warning, saying "IT EXCEEDS THE MAXIMUM ROW SIZE OF 8061" bytes.

    I need to add about 8000 char long values in 2 of the fields.

    So what should I do.? Do I need to select the datatype as TEXT or any other datatype for those columns..?

    Please help.

    I get this warning only in Query Analyzer. Using enterprize manager table gets created without any warning or error...

    I have never faced this problem in SQL2K5 while creating tables.But this limitation is there for Indexes and I could use INCLUDE key word for that.

    Thanks.

  • Enterprise manager's just hiding the warnings. The max size for a row is 8060 bytes. You can create the table, but should any insert try and add more than 8060 bytes to the row, the insert will fail.

    If you need that much space, you'll have to use TEXT columns.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Text data-type is one way to go on that. The other is to vertically partition the table.

    If, for example, the table has an ID column, then you have the "main table" with the ID and all the columns except the two varchar(8000) columns, then you have two other tables, each has just the ID and one of the varchar(8000) columns. The other two have FK with cascading delete to the main table.

    Makes inserts and updates a little more complicated, but allows you to have the data the way you need.

    - 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

  • Thank you Gails & GSquared.

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

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