February 7, 2008 at 4:56 pm
We have a very wide table that exceeds 8k size for each row. This is not a BLOB object, but simply a very large number of wide columns. Is there a work around this limitation ?
Thanks
February 7, 2008 at 4:59 pm
To the best of my knowledge. NO. Are they variable columns datatypes.?
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
February 7, 2008 at 6:33 pm
Refactor
Split the rows up into multiple tables with a link.
February 7, 2008 at 8:26 pm
VARCHAR(MAX)
--Jeff Moden
Change is inevitable... Change for the better is not.
February 8, 2008 at 8:16 am
Sugesh: most of the columns are fixed width, however some of them are varchar.
Pam: this is what I am also thinking about, I thought I would find a better solution.
Jeff: In my tests I tried varchar(max), however SQL Server inserts only first 8000 chars of them . Here is my test:
create table
wide_table
(id int identity,
length int,
string varchar(max)
)
go
declare
@length int,
@string varchar(max)
set @length = 9000
select @string = replicate('a' , @length)
insert into wide_table
(length, string)
values (@length, @string)
select id, length , actual_length=len(string)
from wide_table
The result set is:
id length actual_length
----------- ----------- --------------------
2 9000 8000
February 8, 2008 at 2:33 pm
Vertical partion on the table is the only real way. Works just fine.
- 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
February 8, 2008 at 3:12 pm
Varchar(max) works fine ... from BOL for replicate:
If character_expression is not of type varchar(max) or nvarchar(max), REPLICATE truncates the return value at 8,000 bytes. To return values greater than 8,000 bytes, character_expression must be explicitly cast to the appropriate large-value data type.
Because you passed 'a' to replicate, it truncated the return value.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply