473,785 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NTEXT vs NVARCHAR for large number of columns

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(column Name, '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.
Jul 23 '05 #1
7 12194
-----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:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQlRDaIechKq OuFEgEQLbewCgxM bvyyacTTgytXK8v zNSUaL/n5YAn19E
W7I2V1XUf2izxY5 DhSPmAqn5
=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(column Name, '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?

Jul 23 '05 #2
Are some or most of these columns NULLable?
What information are you storing in these columns?

"Oleg Ogurok" <ol**@ogurok.ir eallyhatespamme rs.com> wrote in message
news:eb******** ***********@new sread1.mlpsca01 .us.to.verio.ne t...
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(column Name, '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.

Jul 23 '05 #3
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" <rd*****@savant softNOSPAM.net> wrote in message
news:uR******** ******@TK2MSFTN GP15.phx.gbl...
Are some or most of these columns NULLable?
What information are you storing in these columns?

"Oleg Ogurok" <ol**@ogurok.ir eallyhatespamme rs.com> wrote in message
news:eb******** ***********@new sread1.mlpsca01 .us.to.verio.ne t...
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(column Name, '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.


Jul 23 '05 #4
Yep, I need unicode and the data can be between 100 and 255 chars long in
most cases.

-Oleg.

"MGFoster" <me@privacy.com > wrote in message
news:Jr******** *******@newsrea d3.news.pas.ear thlink.net...
-----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:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQlRDaIechKq OuFEgEQLbewCgxM bvyyacTTgytXK8v zNSUaL/n5YAn19E
W7I2V1XUf2izxY5 DhSPmAqn5
=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(column Name, '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?

Jul 23 '05 #5
Cant you normalize this ?
Greg Jackson
PDX, Oregon
Jul 23 '05 #6

"Oleg Ogurok" <ol**@ogurok.ir eallyhatespamme rs.com> wrote in message
news:eb******** ***********@new sread1.mlpsca01 .us.to.verio.ne t...
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. :-)


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(column Name, '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.



Thanks.
-Oleg.

Jul 23 '05 #7
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 - dr***@hotmail.c om
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" <Gr************ *@Hotmail.com> wrote in message
news:e7******** ******@TK2MSFTN GP09.phx.gbl...
Cant you normalize this ?
Greg Jackson
PDX, Oregon

Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4488
by: tony | last post by:
I changed the datatype of a field in a SQL Server 2000 database from nvarchar to ntext, but now nothing is being displayed. The "Body" column of the datatable used to be nvarchar(8000) and the below code works fine. However once I changed the datatype of "Body" from nvarchar to ntext, it no longer is displayed. Changing the field back to nvarchar and it is fine again. Is there a special way for me to retrieve ntext fields? Any help...
3
2636
by: Anand | last post by:
If I insert 8000 byte of data, in the one of the column. now I want to read the data, is there any to see all the data, through select statement?
5
18536
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have tried the following and playing around with the following: declare @valuePointer varbinary(16)
1
6303
by: Derek Erb | last post by:
SQL Server 2000 : I have a series of tables which all have the same structure. When any of these tables are modified I need to syncrhonise all of those modifications with one other table wich is a sort of merge of the individual tables with one extra column. For most of these tables this is not a problem. The problem arrives when one of the tables has an ntext column which obviously can not be used in an update or insert trigger. ...
6
6810
by: rey | last post by:
Hello, I need to produce with T-SQL a user defined function or stored procedure that make one SLQ-Statement and prepare as string from the result set. The request muss be able to return a very long unicode string. The return value nvarchar is being truncated so I'm trying to create a stored procedure, that returns a ntext string. I can't manage it (I am no T-SQL specialist). Maybe someone can help
1
2004
by: Rippo | last post by:
I am returning a datatable from a stored procedure and then iterating through the columns. I am trying to find out if a column has the sql data type of ntext. In .net the datatype of a sql ntext column is System.String. .Net also returns System.String for varchar, char, text, nvarchar and nchar. This obviously does not help me as I want to identify the ntext column I have searched for this and cannot find the answer in .net. I can...
10
6943
by: Jerry | last post by:
Hello! I have a SQL Server database with gif images stored in a nText field as binary. I've been asked to export these images to actual gif files (about 250 of them). I found a stored procedure that was using some ADO and it would write a small part of the image correctly and then the rest was a mess. I was told to check out the ADO and VB groups to see if anyone knows of a solution for this. Does anyone have any resources or examples...
4
3631
by: Cylix | last post by:
Is there any difference between a nText field value='' and value=NULL ?
3
2961
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT datatype for the file instead of using IMAGE datatype. I can not use SqlDataReader to read the data. I need your help, Thanks. -David (1) I have a table TestFile for testing: ID int FileName navrchar(255)
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.