1
我正在构建一个报告以执行简单搜索工具来搜索VARCHAR(MAX)文本Blob。我试图让用户可以选择两种不同的搜索类型:包含所有搜索词,并包含任何搜索词。我无法找到可用于在包含all和Contains any之间进行更改的语法。以下是我希望如何工作的要点。谢谢您的帮助!在Transact-SQL中,如何更改包含all和包含任何使用参数
Where Reprt.DateStamp >= @StartDate and Reprt.DateStamp <= @EndDate and
IF @SearchType = 'And'
Reprt.ContentText like '%'[email protected]+'%' and
Reprt.ContentText like '%'[email protected]+'%' and
Reprt.ContentText like '%'[email protected]+'%' and
Reprt.ContentText like '%'[email protected]+'%'
Else
Reprt.ContentText like '%'[email protected]+'%' or
Reprt.ContentText like '%'[email protected]+'%' or
Reprt.ContentText like '%'[email protected]+'%' or
Reprt.ContentText like '%'[email protected]+'%'
错字遗憾意味着跨或Transact-SQL –