There is a problem occurs when I search data using full-text search with SQL Server 2008.
When I search data with no blank space it works but when I enter data with blank spaces it gives an error.
Like if I search 'amit' it works but if data is 'amit is working' it gives error.
I am using ASP.NET MVC 4.0 with SQL Server 2008.
Thanks Amit.
Create PROC [usp_Feedback_Search]
@Word nvarchar(500) ,
@CompanyId UNIQUEIDENTIFIER
As
IF ISNULL(@Word,'') = ''
BEGIN
Select
[Id] ,
[Content] ,
[UserId],
[VoteCount] ,
[IsOpen],
[Deleted],
[RowVersion],
[CreatedBy],
[CreatedOn],
[UpdatedOn],
[UpdatedBy],
[CompanyId],
[DisplayId],
[Status]
FROM Feedback
WHERE CompanyId=@CompanyId
END
ELSE
BEGIN
DECLARE @formatedWord varchar(500)='"'+@word+'\+"'
Select
[Id] ,
[Content] ,
[UserId],
[VoteCount],
[IsOpen],
[Deleted],
[RowVersion],
[CreatedBy],
[CreatedOn],
[UpdatedOn],
[UpdatedBy],
[CompanyId],
[DisplayId],
[Status]
FROM Feedback
Where CONTAINS(*,@Word)
and CompanyId=@CompanyId
END
GO
Dear amit you need to ignore wild card characters like @,spaces etc.
use updated code below:
hope this will work…
http://searchsqlserver.techtarget.com/tip/Using-full-text-search-for-symbols-in-SQL-Server