If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Hindi text in nText column SQL Server 2005

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-10, 01:53
pawangargmit pawangargmit is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
Hindi text in nText column SQL Server 2005

We are using SQL Server 2005, and saving Hindi, English, Japaneese, Chiness languages in nText column.
This all we are doing using google analytical. However, we don't know how to know which value is Hindi or Englsh as they are encoded.

Please suggest how to write a query to know the count for all the rows having Hindi text.

Pawan Garg
Reply With Quote
  #2 (permalink)  
Old 02-05-10, 10:56
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,784
Provided no ntext value (and you should probably change that to nvarchar(max)) has multiple languages, you could try to judge which unicode range the first non whitespace character comes from. It will take me a few minutes to come up with an example, but you should be able to tell what ranges each characterset occupies in the unicode standard.
Reply With Quote
  #3 (permalink)  
Old 02-05-10, 11:02
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,784
Something like this should work out:
Code:
select case when unicode(substring (ntextcolumn, 1, 1)) < 255 then 'English'
    when unicode(substring (ntextcolumn, 1, 1)) < 3000 then 'Hindi' end
from yourtable
Like I said before, you will need to adjust the values and order of checks to make sure you get the right results. You will also need to make sure you get the first non-whitespace character.
Reply With Quote
  #4 (permalink)  
Old 02-06-10, 01:03
pawangargmit pawangargmit is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
How can we find the range for any specific language against a Unicode value... Please suggest
Reply With Quote
  #5 (permalink)  
Old 02-08-10, 10:22
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,784
Well, you could look for the Unicode Code charts.
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On