Solved

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

Posted on 2009-07-10
2
213 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
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 100 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now