Concatenation between two columns in SQL query with Urdu text not working?

Request

declare @string  nvarchar='والد'

SELECT   sCustomerNameUrdu +' '+ @string +' '+sFatherNameUrdu from Customer

      

he gives me

Column1 ??? column2

eg

علی ??? سیعد

but Desired Out Put

Column1 والد column2

eg

علی والد سیعد

+3


source to share


1 answer


Although you declared @string

as nvarchar

, you are not setting the value to a unicode string . So it creates it as an ascii value which will mess it up and then stores the result of that in a Unicode variable.

Also specify the size variable, otherwise it will be 1 character.



This should work (notice N

before the line):

declare @string nvarchar(50)
set @string = N'والد';

SELECT   sCustomerNameUrdu + N' ' + @string + N' ' + sFatherNameUrdu from Customer

      

+3


source







All Articles