dbTalk Databases Forums  

NTEXT vs NVARCHAR for large number of columns

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss NTEXT vs NVARCHAR for large number of columns in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oleg Ogurok
 
Posts: n/a

Default NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 02:58 PM






Hi all,

I need to store data into about 104 columns. This is problematic with MS
SQL, since it doesn't support rows over 8kb in total size.

Most of the columns are of type NVARCHAR(255), which means we can't have
more than 8092/(255*2) = 15 columns of this type.

With a row length of more than 8kb, SQL gives a warning that any rows over
that amount will be truncated.

So far I'm seeing two possible solutions to this problem:
1. Split data into multiple tables with the same ID column accross all
tables, and then join them on SELECT statements.

2. Use NTEXT instead of NVARCHAR. NTEXT's length is 16 bytes because it
contains a pointer to the actual value stored somewhere else. However, NTEXT
doesn't support regular indexing, only through a Full-Text Index catalog. In
this case I'll need to user "WHERE CONTAINS(columnName, 'sometext')" to
perform searches, which is bearable.

I'm inclined toward #2. However I haven't used Full-Text indices before and
don't know their limitations. Will I run into problems with NTEXT? Is there
a better solution?


Thanks.
-Oleg.



Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 03:15 PM






-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

NVarchar is a Unicode data type; do you need to use Unicode? If not
change the data type to Varchar. Does each column have to be 255 chars
wide? If not change the Varchar width to whatever is needed for each
column.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQlRDaIechKqOuFEgEQLbewCgxMbvyyacTTgytXK8vzNSUa L/n5YAn19E
W7I2V1XUf2izxY5DhSPmAqn5
=t8Ui
-----END PGP SIGNATURE-----


Oleg Ogurok wrote:
Quote:
Hi all,

I need to store data into about 104 columns. This is problematic with MS
SQL, since it doesn't support rows over 8kb in total size.

Most of the columns are of type NVARCHAR(255), which means we can't have
more than 8092/(255*2) = 15 columns of this type.

With a row length of more than 8kb, SQL gives a warning that any rows over
that amount will be truncated.

So far I'm seeing two possible solutions to this problem:
1. Split data into multiple tables with the same ID column accross all
tables, and then join them on SELECT statements.

2. Use NTEXT instead of NVARCHAR. NTEXT's length is 16 bytes because it
contains a pointer to the actual value stored somewhere else. However, NTEXT
doesn't support regular indexing, only through a Full-Text Index catalog. In
this case I'll need to user "WHERE CONTAINS(columnName, 'sometext')" to
perform searches, which is bearable.

I'm inclined toward #2. However I haven't used Full-Text indices before and
don't know their limitations. Will I run into problems with NTEXT? Is there
a better solution?

Reply With Quote
  #3  
Old   
Oleg Ogurok
 
Posts: n/a

Default Re: NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 03:57 PM



About 50 (half) of them are nullable. I'm storing mostly various contact
info as well as some business-related data that needs to be searchable. Most
data is 100-200 characters long.

-Oleg.

"Raymond D'Anjou" <rdanjou (AT) savantsoftNOSPAM (DOT) net> wrote

Quote:
Are some or most of these columns NULLable?
What information are you storing in these columns?

"Oleg Ogurok" <oleg (AT) ogurok (DOT) ireallyhatespammers.com> wrote in message
news:ebX4e.61035$NC6.41820 (AT) newsread1 (DOT) mlpsca01.us.to.verio.net...
Hi all,

I need to store data into about 104 columns. This is problematic with MS
SQL, since it doesn't support rows over 8kb in total size.

Most of the columns are of type NVARCHAR(255), which means we can't have
more than 8092/(255*2) = 15 columns of this type.

With a row length of more than 8kb, SQL gives a warning that any rows
over
that amount will be truncated.

So far I'm seeing two possible solutions to this problem:
1. Split data into multiple tables with the same ID column accross all
tables, and then join them on SELECT statements.

2. Use NTEXT instead of NVARCHAR. NTEXT's length is 16 bytes because it
contains a pointer to the actual value stored somewhere else. However,
NTEXT
doesn't support regular indexing, only through a Full-Text Index
catalog.
In
this case I'll need to user "WHERE CONTAINS(columnName, 'sometext')" to
perform searches, which is bearable.

I'm inclined toward #2. However I haven't used Full-Text indices before
and
don't know their limitations. Will I run into problems with NTEXT? Is
there
a better solution?


Thanks.
-Oleg.







Reply With Quote
  #4  
Old   
Oleg Ogurok
 
Posts: n/a

Default Re: NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 03:58 PM



Yep, I need unicode and the data can be between 100 and 255 chars long in
most cases.

-Oleg.

"MGFoster" <me (AT) privacy (DOT) com> wrote

Quote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

NVarchar is a Unicode data type; do you need to use Unicode? If not
change the data type to Varchar. Does each column have to be 255 chars
wide? If not change the Varchar width to whatever is needed for each
column.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQlRDaIechKqOuFEgEQLbewCgxMbvyyacTTgytXK8vzNSUa L/n5YAn19E
W7I2V1XUf2izxY5DhSPmAqn5
=t8Ui
-----END PGP SIGNATURE-----


Oleg Ogurok wrote:
Hi all,

I need to store data into about 104 columns. This is problematic with MS
SQL, since it doesn't support rows over 8kb in total size.

Most of the columns are of type NVARCHAR(255), which means we can't have
more than 8092/(255*2) = 15 columns of this type.

With a row length of more than 8kb, SQL gives a warning that any rows
over
that amount will be truncated.

So far I'm seeing two possible solutions to this problem:
1. Split data into multiple tables with the same ID column accross all
tables, and then join them on SELECT statements.

2. Use NTEXT instead of NVARCHAR. NTEXT's length is 16 bytes because it
contains a pointer to the actual value stored somewhere else. However,
NTEXT
doesn't support regular indexing, only through a Full-Text Index
catalog. In
this case I'll need to user "WHERE CONTAINS(columnName, 'sometext')" to
perform searches, which is bearable.

I'm inclined toward #2. However I haven't used Full-Text indices before
and
don't know their limitations. Will I run into problems with NTEXT? Is
there
a better solution?



Reply With Quote
  #5  
Old   
pdxJaxon
 
Posts: n/a

Default Re: NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 05:52 PM



Cant you normalize this ?


Greg Jackson
PDX, Oregon



Reply With Quote
  #6  
Old   
Greg D. Moore \(Strider\)
 
Posts: n/a

Default Re: NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 07:49 PM




"Oleg Ogurok" <oleg (AT) ogurok (DOT) ireallyhatespammers.com> wrote

Quote:
Hi all,

I need to store data into about 104 columns. This is problematic with MS
SQL, since it doesn't support rows over 8kb in total size.

Most of the columns are of type NVARCHAR(255), which means we can't have
more than 8092/(255*2) = 15 columns of this type.
Actually you CAN have more columns than 15, you just can't fill them all at
once. That's the "beauty" of varchar. :-)


Quote:
With a row length of more than 8kb, SQL gives a warning that any rows over
that amount will be truncated.

So far I'm seeing two possible solutions to this problem:
1. Split data into multiple tables with the same ID column accross all
tables, and then join them on SELECT statements.

2. Use NTEXT instead of NVARCHAR. NTEXT's length is 16 bytes because it
contains a pointer to the actual value stored somewhere else. However,
NTEXT
doesn't support regular indexing, only through a Full-Text Index catalog.
In
this case I'll need to user "WHERE CONTAINS(columnName, 'sometext')" to
perform searches, which is bearable.

I'm inclined toward #2. However I haven't used Full-Text indices before
and
don't know their limitations. Will I run into problems with NTEXT? Is
there
a better solution?
I'd go with 1.


Quote:

Thanks.
-Oleg.





Reply With Quote
  #7  
Old   
Louis Davidson
 
Posts: n/a

Default Re: NTEXT vs NVARCHAR for large number of columns - 04-06-2005 , 09:51 PM



This would be my feeling as well. Normalizing these structures should be
your first step. 50 columns of 255 chars each is nuts, and 104 is
incredibly nuts. Compound that by 104 text columns and your system will be
a real pain.

Can you give us more information about what you want to do.

--
----------------------------------------------------------------------------
Louis Davidson - drsql (AT) hotmail (DOT) com
SQL Server MVP

Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored
"pdxJaxon" <GregoryAJackson (AT) Hotmail (DOT) com> wrote

Quote:
Cant you normalize this ?


Greg Jackson
PDX, Oregon




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.