| Author |
Topic |
|
Marioi
Posting Yak Master
132 Posts |
Posted - 2005-09-27 : 11:10:49
|
| I am new to SQL Server and would like to hear opinions on pros and cons of using nText vs. nVarChar data type for following uses:URLs (up to 260 bytes)Addresses (50-300 bytes)Descriptions and comments (50-2,000 bytes)Memos (up to 8000 bytes)TIA. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-09-27 : 11:27:53
|
use nvarchars for all except memos.Go with the flow & have fun! Else fight the flow |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-09-27 : 11:29:22
|
| NVARCHAR uses 2-byte characters so only half the "max" data (4000 vs 8000) characters can be stored. If you must support UTF-8 character sets, NVARCHAR is the way to go. If not, stick with VARCHAR for single-character character sets.TEXT is intended for data in excess of 8000 bytes, but it can't be indexed, so you'll have to design a lookup scheme other than searching for matches in the TEXT column.There's more on this subject that I'm sure others will contribute. |
 |
|
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2005-09-28 : 10:35:40
|
| Don't use ntext unless no other option. The function which work on string will not work on text data type. like replace, substring.etc..------------------------I think, therefore I am - Rene Descartes |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-28 : 10:37:13
|
>>The function which work on string will not work on text data type. like replace, substring.etc..I think substring will work in Text columns MadhivananFailing to plan is Planning to fail |
 |
|
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2005-09-28 : 10:43:16
|
| Thank you Madhivanan. I think len is not working on text. I remember i was using datalength on text.------------------------I think, therefore I am - Rene Descartes |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-28 : 10:56:58
|
| Len, Replace wont work on text columns but Substring will workMadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-28 : 15:50:16
|
| Use VARCHAR in favour of TEXT where/whenever you canKristen |
 |
|
|
Marioi
Posting Yak Master
132 Posts |
Posted - 2005-11-14 : 17:25:41
|
quote: Originally posted by madhivanan Len, Replace wont work on text columns but Substring will work
According to the 'Substring' topic in Books On Line T-SQL reference, text is returned as varchar, image as varbinary and ntext as nvarchar. |
 |
|
|
|