SQL Server Performance Forum – Threads Archive
nchar and ntext data typeI would like to know the meaning of the ‘nchar’ and ‘ntext’ data type (I do not know what does ‘Unicode’ means). I have already read in some manuals and BOL and I continue understanding the type of data. Thanks for your time,
May refer this DBjournalhttp://www.databasejournal.com/features/mssql/article.phpr/2212141 article. Unicode data is stored using the nchar, nvarchar, and ntext data types in SQL Server. Use these data types for columns that store characters from more than one character set. The SQL Server Unicode data types are based on the National Character data types in the SQL-92 standard. SQL-92 uses the prefix character n to identify these data types and values.
Also, check this link for additional info RE: Unicode, http://www.unicode.org/ Jon M
Could you give me an example of this data type (nchar and ntext) please? A clear example [<img src=’/community/emoticons/emotion-2.gif’ alt=’‘ />]<br /><br />
BOL states :<br /><br />DECLARE @nstring nchar(<img src=’/community/emoticons/emotion-11.gif’ alt=’8)’ /><br />SET @nstring = N’KÃƒÂ¸benhavn'<br />SELECT UNICODE(SUBSTRING(@nstring, 2, 1)), <br /> NCHAR(UNICODE(SUBSTRING(@nstring, 2, 1)))<br />GO<br /><br />use pubs<br /> go<br /> sp_dboption ‘pubs’, ‘select into/bulkcopy’, ‘true'<br /> go<br /> if object_id(‘t1′,’U’) is not null<br /> drop table t1<br /> go<br /> create table t1(c1 ntext,c2 text)<br /> go<br /> insert t1 values(‘test_ntext’,’test_text’)<br /> go<br /> select * from t1<br /> go<br />—<br /><br />BTW where you want to use these datatypes?<br /><br /<a target="_blank" href=http://www.sswug.org/see/15733>http://www.sswug.org/see/15733</a><br />_________<br />Satya SKJ<br />Moderator<br />SQL-Server-Performance.Com<br />
I only want to know what kind of data could be needed this data type, I can not imagine what kind of data could be, for instance for name of users I use ‘char’, for e-mail adress I use ‘varchar’,etc.. ‘Nchar’ and ‘ntext’are the unique data types that I do not understand what kind of data can needed.
These are used only when you need support for some specific languages like japanese as their character set does not fit in the regular 256 character set that we have. So only when you need international support for your application, use these data types. HTH. Gaurav
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard
Perfect [<img src=’/community/emoticons/emotion-1.gif’ alt=’‘ />], thank you!<br /><br />Cesar