berkshirea
Technical User
hi guys i have this code and it inserts into my database. the thing about this is sometimes it inserts the words into the field 2 or more times. sometimes it just inserts the words once(which it should be). do you have any ideas about this guys? i've searched the net but didn't find any good lead. btw, my sqlserver is version 2k-8.00.760
Code:
CREATE PROCEDURE countsSearch
(@searchKeywords varchar(50))AS
BEGIN
DECLARE @countCountries int
SELECT @countCountries= Count(Countries.id)
FROM Countries
WHERE
Countries.Details LIKE '%' + @searchKeywords + '%'
INSERT INTO keywordsTable (keywordSearch)
SELECT @searchKeywords WHERE (@countCountries) > 0
RETURN
END