tsql check if a word is founded in an array of word ..

for example i have an array contain set of words
i want to check if the variable @word is founded in the array contains set of word
please can you declare of me a array contain set of word and what function or if statement should be witted to check in @word is in @arrayofword
LVL 1
AFIF JABADOAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
Not sure what you mean but the result in a new array
what I'm understanding is:
Declare @word varchar(100),
             @arrayofword  varchar(1000)

select @word = 'visit' , @arrayofword = 'jason, test, visit'

select charindex(@word,@arrayofword) 

Open in new window

0
 
PortletPaulCommented:
an "array"?
do you have at least one table involved?
please provide us with some more details of what the database stores (e.g. a table) otherwise we are totally guessing.
0
 
awking00Commented:
Since we're guessing -
where patindex(@word,@arrayof word) > 0
0
 
Bhavesh ShahLead AnalysistCommented:
what I'm understanding is

declare @str1 varchar(500)
set @str1 = 'angel,sage,master,wizard'

select charindex('master',@str1) 

Open in new window

0
 
awking00Commented:
Selecting charindex [or patindex] (@word,@arrayofword) would produce 12 and 14 respectively for the last two offered solutions, so I think what you're looking for is more like select <whatever> where charindex((@word,@arrayofword) > 0
0
All Courses

From novice to tech pro — start learning today.