Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Rita Bhatnagar
Posting Yak Master
172 Posts |
Posted - 2002-04-04 : 10:59:56
|
Hi,I read somewhere Don't use varchar(8000).Why can't we do that. What is the character limit(orbyte limit)per row for a table. Is it different for sql 2k.It was 8064 for sql 7.Regards.Rita |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-04-04 : 11:06:06
|
Where did you read it? Can you provide a link?Never trust a blanket statement...EVER. If varchar(8000) was ALWAYS bad, it wouldn't be available in the database product. |
|
|
Rita Bhatnagar
Posting Yak Master
172 Posts |
Posted - 2002-04-04 : 11:19:10
|
I'm sorry i don't have the link now.The Writer was referencing one person.This person had some problem updating the table because he had 5 varchar(8000) fields and one time it had more than 9000 characters(bytes)per row. Do we still have some limit on how many characters per row?Thanks. |
|
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-04-04 : 11:30:55
|
Of course he had a problem! Varchar is a variable-length datatype, which means the space for the data isn't reserved ahead of time. So if this guy created a table with multiple varchar(8000) columns it may have worked ok for a while as long as the combined length of the data inserted into every column did not exceed 8060 bytes (yes, it is the same for SQL7 and SQL2k). As soon as this number was exceeded, he got an error. Instead of blaming varchar datatype for his troubles he should have put a little bit more thought into his initial table design. The problem could have been easily avoided by vertically partitioning the data across multiple tables.---------------Strong SQL Developer wanted in the Boston area. Please e-mail if interested.Edited by - izaltsman on 04/04/2002 11:32:31 |
|
|
Jay99
468 Posts |
Posted - 2002-04-04 : 11:35:04
|
SQL 7 and SQL 2k both ALWAYS use 8K data pages . . .quote: Never trust a blanket statement...EVER.
hehehehe . . . good oneJay<O> |
|
|
Rita Bhatnagar
Posting Yak Master
172 Posts |
Posted - 2002-04-04 : 11:43:01
|
Thanks. |
|
|
|
|
|