Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to search for all keywords inclusive
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01357215
Message ID:
01357226
Views:
18
The reason I could not make it to work yesterday was that I didn't put alltrim and I was trying to do this at ~2am. But it's good VFP works the same way as SQL Server in this regard.

I also reviewed a bit 'Programming SQL Server 2005' book I have trying to make a solution in my mind.

>Here VFP 9 Version :-)
>
>CREATE cursor MainC ;
>(ID_Field I, char_Field c(250))
>INSERT INTO MainC VALUES (1,'Mother Father Daughter Son')
>INSERT INTO MainC VALUES (2,'Mother Daughter Son')
>INSERT INTO MainC VALUES (3,'Mother Son')
>INSERT INTO MainC VALUES (4,'Daughter Son')
>INSERT INTO MainC VALUES (5,'Mother Father Son')
>INSERT INTO MainC VALUES (6,'Son Daughter Father')
>INSERT INTO MainC VALUES (7,'Mother Son')
>INSERT INTO MainC VALUES (8,'Other Word')
>
>SELECT 0
>CREATE CURSOR KeyWords (Word C(20), IF I)
>INSERT INTO KeyWords VALUES ('Mother',1)
>INSERT INTO KeyWords VALUES ('Father',2)
>INSERT INTO KeyWords VALUES ('Son',3)
>INSERT INTO KeyWords VALUES ('Daughter',4)
>lnCount = RECCOUNT()
>
>SELECT M.*;
>FROM MainC M ;
>INNER JOIN (;
>SELECT MainC.Id_Field;
>                   FROM MainC ;
>            INNER JOIN KeyWords K2 ON MainC.char_Field LIKE '%'+ALLTRIM(K2.Word)+'%';
>            GROUP BY MainC.Id_Field;
>            HAVING COUNT(*) = lnCount;
>) K33;
>ON M.ID_Field  = K33.ID_Field 
>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform