Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

IN sql server 2005 how to write a function to find words in a sentence.

Posted on 2009-07-10
2
Medium Priority
?
260 Views
Last Modified: 2012-05-07
for example
create function find_qualification_exists(@name varchar(65))

the @name is included with qualification. for example : 'Mark Froster MA, CRC,CCM,RN'.
i have the qualifications list. ('abc','xxx','ccm','rn','crc','xyz','lmn','opq')
Now i need to write a query to check whether/not the @name has at least one qualication.

Function should return 'yes' if qualification exists or 'no' if not.
0
Comment
Question by:nreich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:nreich
ID: 24825914
i need to write a query to check whether/not the @name has at least one qualication from the list given.
0
 
LVL 41

Accepted Solution

by:
ralmada earned 300 total points
ID: 24826195
Can you put the qualification in a temp table? then you can give this a try
declare @name varchar(50)
 
set @name = 'Mark Froster MA, CRC,CCM,RN'
 
 
declare @ttable (
quali varchar(10)
)
 
 
insert @ttable
value ('abc')
...
 
 
select top 1 case when patindex('%'+quali+'%', @name) = 0 then 'No'
	else 'Yes' end as result
from @ttable
order by 1 DESC

Open in new window

0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question