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.
Author |
Topic |
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-02 : 04:14:19
|
Hi all,I am trying to search a unicode text code against a db tbl. However, below query doesnt work. I need help with that..declare @finsoftKeys nvarchar(1000)select @finsoftKeys = 'Soför/ Destek|Genel Müdürlük|Soför|Soför,Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü';with csvtbl(i,j)as( select i=1, j=charindex(',',@finsoftKeys+',') union all select i=j+1, j=charindex(',',@finsoftKeys+',',j+1) from csvtbl where charindex(',',@finsoftKeys+',',j+1) <> 0),cte as( select val = substring(@finsoftKeys,i,j-i) from csvtbl )select *from ctewhere val not in (select distinct ident_org from org_) |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-02 : 06:30:56
|
What do you mean by it doesn't work?Have you checked the data you are searching and searching for?Does your collation allow distinguishing between accented characters?I notice your keys have , and | and you are using , to delimit - is that correct?==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-02 : 08:21:27
|
quote: Originally posted by nigelrivett What do you mean by it doesn't work?Have you checked the data you are searching and searching for?Does your collation allow distinguishing between accented characters?I notice your keys have , and | and you are using , to delimit - is that correct?==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
it brings some records, not all, yes i am using pipe to concat the text but the main list separator is "comma".... |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-02 : 20:05:03
|
does that mean you dont want data to be split up based on |?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-04 : 06:42:00
|
quote: Originally posted by visakh16 does that mean you dont want data to be split up based on |?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Yes, I need to split from "comma" not pipe("|") |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-04 : 18:47:23
|
so what should be end output?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-05 : 02:24:37
|
quote: Originally posted by visakh16 so what should be end output?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
It seems like it is not using unicode text to find the correct number of rows. It does search only English chars not Turkish... How will I make the code to the unicode search against db tbl? |
 |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-05 : 04:11:31
|
When I run that query I get two rows.What do you get?Be nice if you told us what the actual issue is as per my first postThis gives two rows as expected on my machinenote: I've change the value in @finsoftKeys to nvarchardeclare @finsoftKeys nvarchar(1000)select @finsoftKeys = N'Soför/ Destek|Genel Müdürlük|Soför|Soför,Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü'declare @t table (s nvarchar(1000))insert @t select N'Soför/ Destek|Genel Müdürlük|Soför|Soför'insert @t select N'Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü';with csvtbl(i,j)as(select i=1, j=charindex(',',@finsoftKeys+',')union allselect i=j+1, j=charindex(',',@finsoftKeys+',',j+1) from csvtblwhere charindex(',',@finsoftKeys+',',j+1) <> 0),cte as(select val = substring(@finsoftKeys,i,j-i)from csvtbl )select *from ctewhere val in (select s from @t)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-06 : 02:47:12
|
quote: Originally posted by nigelrivett When I run that query I get two rows.What do you get?Be nice if you told us what the actual issue is as per my first postThis gives two rows as expected on my machinenote: I've change the value in @finsoftKeys to nvarchardeclare @finsoftKeys nvarchar(1000)select @finsoftKeys = N'Soför/ Destek|Genel Müdürlük|Soför|Soför,Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü'declare @t table (s nvarchar(1000))insert @t select N'Soför/ Destek|Genel Müdürlük|Soför|Soför'insert @t select N'Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü';with csvtbl(i,j)as(select i=1, j=charindex(',',@finsoftKeys+',')union allselect i=j+1, j=charindex(',',@finsoftKeys+',',j+1) from csvtblwhere charindex(',',@finsoftKeys+',',j+1) <> 0),cte as(select val = substring(@finsoftKeys,i,j-i)from csvtbl )select *from ctewhere val in (select s from @t)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
I have tried this :declare @RMKeys nvarchar(3000)select @RMKeys = N'Aktif Pasif Riski Yönetimi Bölümü|Genel Müdürlük|Yetkili|Aktif Pasif Riski Yönetimi Yetkilisi,Bilgi Yönetimi - Pazarlama ve Satis Bölümü|Genel Müdürlük|Bilgi Mühendisi|Bilgi Yönetimi Bilgi Mühendisi'And I got zero record for above...Some of the letters are shown as English character in this forum after submitting. so that is why you dont see them in this post.You can use the 1st paragph as refence on this article for not showing letters:http://www.hurriyet.com.tr/gundem/20927487.asp |
 |
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-10 : 06:30:03
|
quote: Originally posted by emmim44
quote: Originally posted by nigelrivett When I run that query I get two rows.What do you get?Be nice if you told us what the actual issue is as per my first postThis gives two rows as expected on my machinenote: I've change the value in @finsoftKeys to nvarchardeclare @finsoftKeys nvarchar(1000)select @finsoftKeys = N'Soför/ Destek|Genel Müdürlük|Soför|Soför,Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü'declare @t table (s nvarchar(1000))insert @t select N'Soför/ Destek|Genel Müdürlük|Soför|Soför'insert @t select N'Uygulama Gelistirme-Kredi Kartlari ve ATM Bölümü|Genel Müdürlük|Müdür|Yazilim Gelistirme Müdürü';with csvtbl(i,j)as(select i=1, j=charindex(',',@finsoftKeys+',')union allselect i=j+1, j=charindex(',',@finsoftKeys+',',j+1) from csvtblwhere charindex(',',@finsoftKeys+',',j+1) <> 0),cte as(select val = substring(@finsoftKeys,i,j-i)from csvtbl )select *from ctewhere val in (select s from @t)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
I have tried this :declare @RMKeys nvarchar(3000)select @RMKeys = N'Aktif Pasif Riski Yönetimi Bölümü|Genel Müdürlük|Yetkili|Aktif Pasif Riski Yönetimi Yetkilisi,Bilgi Yönetimi - Pazarlama ve Satis Bölümü|Genel Müdürlük|Bilgi Mühendisi|Bilgi Yönetimi Bilgi Mühendisi'And I got zero record for above...Some of the letters are shown as English character in this forum after submitting. so that is why you dont see them in this post.You can use the 1st paragph as refence on this article for not showing letters:http://www.hurriyet.com.tr/gundem/20927487.asp
No one is helping... What kind of forum is this? |
 |
|
|
|
|
|
|