473,418 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Finding occurence of value in a given string

I have a column say acct_values holding values like "1,8,10,19,20,29,35,50,51"
In a where clause if I have to check 9 in a acct_values column from above values. It gives a positive result becasue 19 and/or 29 contains 9. I have tried "Like/PatIndex/CharIndex" but none of it gives a correct result.
Feb 25 '10 #1
3 1326
ck9663
2,878 Expert 2GB
If you are sure that there are no spaces in between commas, find '%,9,%'.

If there are spaces, remove those spaces before you search for the string pattern.

Good Luck!!!


~~ CK
Feb 25 '10 #2
Thanks for your help, it was great but it does not work in situations where there are strings like "9", "1,2,9".

However, I have acheived the goal through scripting and it is working fine.
Feb 26 '10 #3
deepuv04
227 Expert 100+
this will help

WHERE ',' + @String + ',' LIKE '%,' + acct_values + ',%'
Feb 26 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tesla | last post by:
Hey guys, I have a string like "lalala: djkahsd : dajkdassd : adasd :" Is there a function to find the position of the "I"th occurence of a character/string? Like lets say I want to find out...
1
by: Roland | last post by:
hi all having designed my schema to use repeating groups of elements, I found that some applications (eg. Microsoft InfoPath) refused to recognised that element as a repeating element. I...
8
by: Spondishy | last post by:
This is probably more of a algo question than specifically c# (although a c# solution would be great. I'm trying to parse a string and ensure that at least one occurence of a number of other...
6
by: utab | last post by:
Dear all, I would like to find the occurence of numbers in an array(I solved this problem before now I could not see the solution) but not with iterators or vectors I want to apply them later, I...
3
by: utab | last post by:
Dear all, I tried to solve the occurence problem: to find the distinct occurences of a word in an input. I know that I could use map and other STD lib functions. I tried to do it the hard way. I...
2
by: DaFerg | last post by:
Hi ... I have a weblog database where I want to count the occurences of a table of string values that appear in all the urls viewed. My tblWebLog as a field that contains the url ... tblWebLog....
22
by: jobo | last post by:
Hello, I'm very new to C so please forgive my ineptitude. If I am given a file with "jfewuuj3uefi8jkw128jdmnsdf\s;'d1904" I want to capture each occurence of an integer 0-9 into an array. ...
3
by: Peter Thornqvist | last post by:
How would I design a regular expression to find the first occurence of a specific pattern and not look for more matches? -- Regards, Peter
2
by: gauravguleria | last post by:
wht's the program which takes two strings using command line arguments and finds the occurence of second string in the first string.The program should return the starting position of first...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.