Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Maximum row size in SQL Server 2000. Expand / Collapse
Author
Message
Posted Monday, June 1, 2009 7:53 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 10:55 PM
Points: 1,573, Visits: 2,635
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.



















Post #726672
Posted Monday, June 1, 2009 8:04 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 8:31 AM
Points: 40,456, Visits: 36,912
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 2008, MVP
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

Post #726677
Posted Monday, June 1, 2009 8:08 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Monday, November 17, 2014 12:50 PM
Points: 13,872, Visits: 9,598
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
Post #726681
Posted Monday, June 1, 2009 8:38 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 10:55 PM
Points: 1,573, Visits: 2,635
Thank you Gails & GSquared.
Post #726697
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse