Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Ado Query To Converts Joined Columns Into Rows Based on Primary Key 4 55
Help with query 3 25
Sql server function help 15 30
VB.net and sql server 4 36
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

772 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