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 2000 Forums
 SQL Server Development (2000)
 comparing two strings

Author  Topic 

alxtech
Yak Posting Veteran

66 Posts

Posted - 2005-12-29 : 10:26:53
Hello People,
I am accessing a database to get a value from a table (varchar), this value is always a string of numbers separated by a coma EXAMPLE: 12,39,10,14 each number representing an event category in the database, once i get that value i have to compare it to a string value input by user in my web application, (user input as string), finally i have to display only the events that match both strings values.

Example:
event category: 10,15,16,101,39
user input: 09,10,25,16

result: only events which categories are 10 and 16 must be display.Matching categories

Connection to database is perfectly working, i am able to extract the string value from the database.
Thanks for your help

JasonGoff
Posting Yak Master

158 Posts

Posted - 2005-12-29 : 10:31:31
Hi,

What's your question or problem ? Are you looking for a method to do this ? Which version of SQL server are you using ?

Provide some more info and someone may be able to help.
Go to Top of Page

alxtech
Yak Posting Veteran

66 Posts

Posted - 2005-12-29 : 10:35:40
My question is what is the way to solve this problem comparing the two strings and displaying the events matching, is there a function that does that, or an algorithm approach.
It is an oracle database, so i have to solve this problem with asp code.
Go to Top of Page

JasonGoff
Posting Yak Master

158 Posts

Posted - 2005-12-29 : 10:39:40
Ah,

Well, this is a SQL Server forum, so asking ASP/Oracle questions here may not get you the answer you're looking for !

Try... 4guysfromrolla.com for the ASP side. Oracle = not a clue, sorry !

I would do something like...
Split the user input into atomic values
search the string in the database for each of the values in turn
where you get a match, do whatever process you require.

On a more purist note... NORMALISE your database :-)

Jason.
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2005-12-29 : 11:45:38
quote:
Originally posted by alxtech
this value is always a string of numbers separated by a coma


Presumably the coma is induced by the shock of not storing the data in 1NF
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2005-12-29 : 16:54:44
Well, it's an Oracle database, so the DBA was probably so busy just trying to get the thing running that he didn't have time to create a good schema.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-30 : 00:07:39
Post your oracle questions at
www.DBForums.com
www.lazydba.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -