Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Search ing multiple fields

Author  Topic 

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-03-09 : 12:38:30
I do not have access to full text search, but I need to do a text search on a title field and a description field. What is the best way to do this?

Dave
Helixpoint Web Development
http://www.helixpoint.com

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-03-09 : 12:56:05
Can I make this work...It does not now

ALTER PROCEDURE [dbo].[SearchMovie]
@Title nvarchar(200)
AS
BEGIN
SET NOCOUNT ON;

SELECT *
FROM movies
WHERE PATINDEX(@Title, COALESCE (title, '') + '|' + COALESCE (description, '')) > 0

Dave
Helixpoint Web Development
http://www.helixpoint.com
Go to Top of Page

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-03-09 : 13:22:26
I got it

ALTER PROCEDURE [dbo].[SearchMovie]
@Title nvarchar(200)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

SELECT *
FROM helixpo_CLASSICDVDS.movies
WHERE PATINDEX('%' + @Title + '%', COALESCE (title, '') + '|' + COALESCE (description, '')) > 0
END

Dave
Helixpoint Web Development
http://www.helixpoint.com
Go to Top of Page
   

- Advertisement -