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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Problem With Concatanate Strings

Author  Topic 

krubug
Starting Member

7 Posts

Posted - 2011-06-15 : 02:29:28
Hello
i Worte a code witch concat stings separate with ",".
everything is work great untill one of the concatanate string
holds Characters in different language.
The Main String is in Hebrew and the special Character is in English.

While concatanate them to the main concatanate string all the characters change there position and we get one not correct mixing string .
Is there a way to handle such problem?
Is there a way to hold a string in one peace inside another string?
Thanks,

ibbo14
Starting Member

10 Posts

Posted - 2011-06-15 : 02:47:22
Sounds like a database collation problem. Can you tell us what collation you are using and a sample of the string you are trying to cocatanate?
Go to Top of Page

krubug
Starting Member

7 Posts

Posted - 2011-06-15 : 02:53:34
i Tried To Change The Collation of the the field in the table to SQL_Latin1_General_CP1255_CI_AS.
the collation of the DB is Hebrew.
Furture more i worte a script witch concatantae two strings by decalre and set them (and not from a field)
and still it dont work.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-15 : 03:01:27
Maybe you can show us a bit more what you are doing?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

krubug
Starting Member

7 Posts

Posted - 2011-06-15 : 03:09:24
I hope That you understand but this is the simple scipt:

create table #tmp
(
string nvarchar(max)
)

declare @string1 nvarchar(200)
declare @string2 nvarchar(200)

set @string1='???? ??????'
set @string2='???? B ????? ?????? ?'



select @string1+' , ' +@string2

the Answer:
???? ?????? , ???? B ????? ?????? ?
Instand of :
???? B ???? ?????? , ????? ??????

thanks,
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-15 : 03:31:56
But the Answer:
???? ?????? , ???? B ????? ?????? ?
is correct.
Why do you think the value of @string2 should come first when you are concatenating it to the end of @string1?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

krubug
Starting Member

7 Posts

Posted - 2011-06-15 : 03:56:17
Hi
the correcr string is :
???? B ???? ?????? , ????? ??????
i know that it's difficult to understand from it.
every string should stays as it is like the source.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-15 : 03:59:39
select @string1+' , ' +@string2 is equal to
select '???? ??????' + ' , ' + '???? B ????? ?????? ?'

So the result can't be: '???? B ???? ?????? , ????? ??????'


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -