Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update SQL Server 2008 - Nvarchar -Probelm?

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2011-06-28 : 02:49:31
Hi,
Iam using Sql Server 2008. I have table with arabic datas. Now I want to compare & Update my table, its not working ...I can't understand my mistake

From the below Query Address.person_name,Employee.Employee_name are Arabic Datas. While compare for update its not working...

Thanks for the tips..

My Query
========
update Address set address_code =Employee.address_code from Employee where Address.person_name = Employee.employee_name



Paramu @ PARANTHAMAN

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2011-06-28 : 03:00:36
are you getting any conversion error??...
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2011-06-28 : 03:02:58
make the column datatype as NVARCHAR
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2011-06-28 : 03:05:02
Thanks For Reply..
I am getting the below message..

Cannot resolve the collation conflict between "SQL_LAtinl_Genearal_CPI_CI_AS and "Arabic_CI_AS" in the equal to operation.

Paramu @ PARANTHAMAN
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2011-06-28 : 03:07:00
Address.Code ,Employee.Address_code are varchar(5)

And Address.person_name, Employee.employee_name are Nvarchar(50)

Thanks for comments




Paramu @ PARANTHAMAN
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-06-28 : 03:20:26
something along the lines of below. look of the collation construct for syntax.

update Address
set address_code = Employee.address_code
from Employee
where convertthistoYOURdesiredcollation(Address.person_name) = convertthistoYOURdesiredcollation(Employee.employee_name)

alternatively update your tables to ALL be the same collation....possibly by unloading the data, drop/create the tables better and re-load the data.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-06-28 : 03:39:50
No! Use DATE for date column. It accepts dates from 0001-01-01 to 9999-12-31.

Try this:

update Address
set address_code = Employee.address_code
from Employee
where Address.person_name = Employee.employee_name COLLATE Arabic_CI_AS



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2011-06-28 : 03:57:37
Thanks, I get clear.

Thanks Again.

Paramu @ PARANTHAMAN
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-06-28 : 05:19:59
Peso. (minor correction) no reference to "dates" in OP's original post (non-local english)
"I have table with arabic datas"

good on you for the correct syntax on the collate clause - I just don't use same nor had the time to look it up.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-06-28 : 07:54:24
Thank you. I am using collation changes every day since the other DBA insists in keeping the old default Latin1blablabla collation.

//Peter



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -