2010-11-30 15 views
1

私の問題は、「XXX」のようなテキストを入力して検索ボタンをクリックすると、「XXX」だけのレコードが表示されます。しかし、私は大文字のすべてのレコードと "XXX"の小文字を表示したい。私はフリーテキストを試していますが、 "Freetext 'というキーワードの近くに不正な構文があります。あなたには、いくつかの操作を行う必要はありませんフリーテキスト機能の誰もが私に理由を伝えることができストアドプロシージャのFREETEXT問題

......

私は複数の検索のために以下のコードを使用しています....

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) and (@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 

答えて

0

アクションは列とパラメータを記述するだけです。 MSDN(2番目の例は変数の使用方法を説明しています)を参照してください。

関連する問題