首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >存储过程的FREETEXT问题

存储过程的FREETEXT问题
EN

Stack Overflow用户
提问于 2010-11-30 05:34:16
回答 1查看 549关注 0票数 1

我的问题是,当我输入像"XXX“这样的文本并点击”搜索“按钮时,它只显示"XXX”的记录。但我想展示所有的记录,大写和小写的"XXX“。然后我尝试freetext,但是它显示了“在关键字‘Freetext’附近不正确的语法”。

有人能告诉我原因吗.

我用下面的代码进行多次搜索.

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-11-30 10:55:24

在freetext函数中,您不需要做一些操作,只需描述列和参数。参见MSDN (描述变量使用的第二个示例)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4310827

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档