FREETEXT problem on stored procedure
my problem is when i enter the text like "XXX" and click search button it shows the record for only "XXX". but i want to show all the records of the Uppercase and also the lower case of "XXX". then i try freetext but it shows "Incorrect syntax near the keyword 'Freetext'".
can anyone tell me the reason......
i'm using the below code for multiple search....
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[sp_searchdetails]
@customervendortype varchar(30)=Null,
@customervendorid varchar(30)=Null,
@customervendorname varchar(30)=Null,
@state varchar(30)=Null,
@city varchar(30)=Null
AS
BEGIN
if @customervendortype is not null and len(@customervendortype)=0 set @customervendortype = null
if @customervendorid is not null and len(@customervendorid)=0 set @customervendorid = null
if @customervendorname is not null and len(@customervendorname)=0 set @customervendorname = null
if @city is not null and len(@city)=0 set @city = null
if @state is not null and len(@state)=0 set @state = null
SELECT CustomerVendorDetails.customervendorid,CustomerVendorAddressDetails.customervendorname, CustomerVendorAddressDetails.doorno, CustomerVendorAddressDetails.street,
CustomerVendorAddressDetails.city, CustomerVendorAddressDetails.state, CustomerVendorAddressDetails.country,
CustomerVendorAddressDetails.pincode, CustomerVendorDetails.decidingauthority,
CustomerVendorDetails.landlineno1, CustomerVendorDetails.landlineno2, CustomerVendorDetails.faxno, ContactPersonDetails.contactno,
ContactPersonDetails.designation
FROM
CustomerVendorDetails INNER JOIN
CustomerVendorAddressDetails ON CustomerVendorDetails.customervendorid = CustomerVendorAddressDetails.customervendorid INNER JOIN
ContactPersonDetails ON CustomerVendorAddressDetails.customervendorid = ContactPersonDetails.customervendorid
WHERE
(@customervendortype is null or CustomerVendorDetails.customervendortype like @customervendortype) an开发者_高级运维d (@customervendorid is null or CustomerVendorDetails.customervendorid like @customervendorid) and Freetext (@customervendorname is null or CustomerVendorDetails.customervendorname like @customervendorname ) and Freetext (@city is null or CustomerVendorAddressDetails.city like @city)and Freetext (@state is null or CustomerVendorAddressDetails.state like @state)
END
in freetext function you needn't do some action just describe column(s) and parameters. see MSDN (second example describe variable usage)
精彩评论