Link to home
Start Free TrialLog in
Avatar of vensali
vensaliFlag for India

asked on

how to convert english tesxt to kannada using sql script

I have table where one column is defined as nvarchar.   I would like to update the value in this column with kannada text ,

Update  doctor  set a.docname = b.doctorname
from  doctor a inner join
(
  select rowid, doctorname from doctor
) b on a.rowid = b.rowid

 doctorname is in english.  i want  to update docname in kannada translation of doctorname.
SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PortletPaul
Declare @nvar as nvarchar(max);
set @nvar = N'ವೈದ್ಯರು'

select @nvar

Open in new window

There isn't a problem storing the wanted value, but I am perplexed by your update query.

is there only one table?
or two tables?

or do you have 2 columns in the same table?
@Author -

The update command you are using is bit complex , You can easily modify your update to below -

Update doctor set docname = CAST(doctorname AS NVARCHAR(MAX))

Open in new window

If you have multiple tables then you can use below-

Data Generation and Table creation-

CREATE TABLE doctor
(
	 rowid INT
	,docname  NVARCHAR(1000)	
)
GO

INSERT INTO doctor VALUES ( 1 , 'Pawan' ) 
GO

CREATE TABLE B1
(
	rowid INT
	,docname  NVARCHAR(1000)
)
GO

INSERT INTO B1 VALUES ( 1 , N'पवन' )
GO

Open in new window


BEFORE UPDATE

/*------------------------
SELECT * FROM doctor 
------------------------*/
rowid       docname
----------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1           Pawan

(1 row(s) affected)

Open in new window


Update Solution / Query

UPDATE a
SET a.docname = b.docname
FROM doctor a
INNER JOIN B1 b ON a.rowid = b.rowid

Open in new window


AFTER UPDATE

SELECT * FROM doctor    

/*------------------------

SELECT * FROM doctor       
------------------------*/
rowid       docname
----------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1           पवन

(1 row(s) affected)

Open in new window

Avatar of vensali

ASKER

This is fine . but i wanted something lika sp or function where i pass an english word and get an ouput in kannada.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Provided solution.