ethar turky
asked on
Check if @input has any value listed in keyword table
Dear all,
I need to modify the answer of this question :
https://www.experts-exchange.com/questions/28344773/keywords.html
to check if @input has any word list in keyword Table ( select TagTitle from NewsSYSTags where isComposedTagKeyword=1 )
then add it to @Keyword Table , also remove all founded keywords from @input to prevent it from split function.
thanks
I need to modify the answer of this question :
https://www.experts-exchange.com/questions/28344773/keywords.html
to check if @input has any word list in keyword Table ( select TagTitle from NewsSYSTags where isComposedTagKeyword=1 )
then add it to @Keyword Table , also remove all founded keywords from @input to prevent it from split function.
thanks
ASKER
Dear Surendra Ganti, I don't understand your response.
let's divided to 2 parts
first I need to
insert all key-words in @input founded in keyword here ( select TagTitle from NewsSYSTags where isComposedTagKeyword=1 )
let's divided to 2 parts
first I need to
insert all key-words in @input founded in keyword here ( select TagTitle from NewsSYSTags where isComposedTagKeyword=1 )
thats correct that is exactly how above script works.
and regarding the second requirement of yours, I cannot give you a simple solution without knowing the volumes.
and regarding the second requirement of yours, I cannot give you a simple solution without knowing the volumes.
ASKER
insert all key-words in @input founded in ( select TagTitle from NewsSYSTags where isComposedTagKeyword=1 ) to @keyword
should be done before split
should be done before split
are you looking for something like below???
declare @KeyWords table
(
word VARCHAR(1000)
,Count BIGINT
)
INSERT INTO @KeyWords
(
word,Count
)
select TagTitle,0 from NewsSYSTags where isComposedTagKeyword=1
declare @input nVARCHAR(max)
SET @input = 'A quick brown fox jumped over the hedge of your computer in a bussiness rather quick fashion'
select * FROM dbo.split(@input,' ')
;WITH C AS
(
SELECT COUNT(1) CC,Data FROM dbo.split(@input,' ')
GROUP BY DATA
)
UPDATE K
SET [count] = [count] + CC
FROM @KeyWords K
JOIN C
ON K.word = C.data
;WITH C AS
(
SELECT COUNT(1) CC,Data FROM dbo.split(@input,' ')
GROUP BY DATA
)
INSERT INTO @KeyWords
SELECT DATA,CC FROM C
WHERE NOT EXISTS ( SELECT 1 FROM @KeyWords K WHERE K.word = C.data)
AND EXISTS ( SELECT 1 FROM NewsSYSTags S where isComposedTagKeyword=1 and S.TagTitle = C.data)
SELECT * FROM @KeyWords
ASKER
we have 2 type of keywords ,
first type defined from a keywords master table
second type generated from split statement
****
for first type we need to search any keyword in @input listed in master table of keywords
first type defined from a keywords master table
second type generated from split statement
****
for first type we need to search any keyword in @input listed in master table of keywords
Ok, rather than we go back and forth
Why dont you take an example, this might help us understand the stuff better.
Why dont you take an example, this might help us understand the stuff better.
ASKER
very simple
I have @input , need to find any word in @input listed in simple table ( kID, Keyword) and add the founded in another table
I have @input , need to find any word in @input listed in simple table ( kID, Keyword) and add the founded in another table
Then why are insisting to do it before spliting the @input into a table, it can also be done after the split?
is there any bussiness reason for that?
is there any bussiness reason for that?
ASKER
caz the keywords may contains 2 or more words
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
Open in new window
This will become a cumbersome process and will hit the performance than improving the performance...