LearnItFirst User Forum

New SQL Server 2008 DBA Course
Welcome Guest Search | New Posts | Members | Log In | Register

SQL statement - 'chop' phrase Options
moonsulu
Posted: Thursday, December 17, 2009 10:45:07 AM
Rank: Newbie

Joined: 3/18/2009
Posts: 6
Points: 18

hi guys how do i do this SQL statements when a user typed in search text field in my ASP.net webpage? How do I 'chop' the typed-in phrases?

examples:

1. typed in phrase: marketing assistant jobs

the resulting SQL statement should be:

SELECT field1,field2
FROM myTable
WHERE CONTAINS(*, 'marketing AND assistant AND jobs')

2. typed in phrase: public administration

the resulting SQL would be:

SELECT field1,field2
FROM myTable
WHERE CONTAINS(*, 'public AND administration')

3. typed in phrase: SQL server full text search
result would be:

SELECT field1,field2
FROM myTable
WHERE CONTAINS(*, 'SQL AND server AND full AND text AND search')



thanks for any ideas.
Scott Whigham
Posted: Friday, February 26, 2010 9:01:40 AM


Rank: Super Mod

Joined: 3/20/2006
Posts: 460
Points: 1,002
Where do you live?: Dallas, TX
I think you should do this in .NET - so much faster and easier. This shouldn't be a SQL thing IMO.
GopiMuluka
Posted: Wednesday, June 02, 2010 5:28:26 AM
Rank: Newbie

Joined: 6/2/2010
Posts: 1
Points: 3
Where do you live?: INDIA
check this
DECLARE @STR VARCHAR(500)
SET @STR='marketing assistant jobs'
SELECT REPLACE(@STR,' ',' AND ')
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.