Does SQL Server optimize LIKE ('%%') query?
问题 I have a Stored Proc which performs search on records. The problem is that some of the search criteria,which are coming from UI, may be empty string. So, when the criteria not specified, the LIKE statement becomes redundant. How can I effectively perform that search or Sql Server? Or, Does it optimize LIKE('%%') query since it means there is nothing to compare? The Stored proc is like this: ALTER PROC [FRA].[MCC_SEARCH] @MCC_Code varchar(4), @MCC_Desc nvarchar(50), @Detail nvarchar(50) AS