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 |
nord
Posting Yak Master
126 Posts |
Posted - 2013-10-30 : 13:18:04
|
Hi,I have 2 fields in different tables,I need to find strim=ng in another string for example:column1 column 2 '10' '10','11','12','13' '1','2','3' '1','2','3','4','5'Thanks for help |
|
nord
Posting Yak Master
126 Posts |
Posted - 2013-10-30 : 13:21:42
|
Hi,I have 2 fields in different tables,I need to find strim=ng in another string for example:column1 column 2'10' '10','11','12','13''1','2','3' '1','2','3','4','5'Thanks for help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-30 : 13:24:49
|
do you mean this?SELECT *FROM TableWHERE ',' + column2 + ',' LIKE '%,' + column1 + ',%' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
nord
Posting Yak Master
126 Posts |
Posted - 2013-10-30 : 13:39:18
|
Yes,thankshow I can do it with charindex? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-30 : 13:43:25
|
why? whats the issue with provided suggestion?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-30 : 13:46:09
|
you need PATINDEX and not CHARINDEX as its pattern searchSELECT *FROM TableWHERE PATINDEX('%,' + column1 + ',%',',' + column2 + ',')>0 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
nord
Posting Yak Master
126 Posts |
Posted - 2013-10-30 : 13:49:28
|
Thanks |
|
|
|
|
|
|
|