 |
| SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 20th, 2003, 05:15 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
data type limitation
Someone please suggest a data type to have a larger field then 4000 characters for text..
I am storing web page text in MS SQL server and not a big sql person - using aspx... I cant find another way other then spanning 1-4000 characters in field1, 4001 - 8000 in field2, etc.
Please help,
Nick
|
|

September 20th, 2003, 05:29 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
You can use varchar and nvarchar datatypes for smaller text values. The varchar can hold up to 8,000 characters, the nvarchar 4,000.
You'll need to use the Text or NText datatypes if you need to store larger text. The Text datatype can store up to 2,147,483,647 characters.
If you have Books Online installed for SQL Server, take a look here:
mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%2 0Server\80\Tools\Books\tsqlref.chm::/ts_da-db_7msw.htm
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

October 16th, 2003, 11:38 AM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
I have tried to use varchar(8000) and text in my SQL Server 7.0 to hold some text with the length less than 8000 characters.
I could enter a block of text in a form, then it was submited, saved into my database and displayed back on the web. The trouble was that it only displayed 4000 characters and cut off the rest of it.
I know when using varchar, i need to to: convert(text, comments) as [comments] in the SQL. Still doesn't work. By the way, i'm using PHP script.
Please give me some hints how to use data type or how to get all my text displayed.
Thank you so much in advance for any inputs.
trang
|
|

October 16th, 2003, 11:51 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Since your limit appears to be one-half of the assigned field size, you may be having a problem with the Unicode character set and the ANSI character set.
Try changing the varchar's to nvarchar's. If that works, then you are actually inputting Unicode data as opposed to ANSI data.
Good luck!
Rand
|
|

October 16th, 2003, 03:18 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you so much for quick response. I have tried nvarchar, but it didn't display anything.
weird.
Quote:
quote:Originally posted by rgerald
Since your limit appears to be one-half of the assigned field size, you may be having a problem with the Unicode character set and the ANSI character set.
Try changing the varchar's to nvarchar's. If that works, then you are actually inputting Unicode data as opposed to ANSI data.
Good luck!
Rand
|
|
|

October 17th, 2003, 05:17 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Why didn't you go for text datatype when you are sure it would be around 8000 characters.
That should be the ideal one in your case.
Cheers
Vijay G
|
|
 |