What is best way to search from optional parameter to SQL query in a stored procedure?
问题 When it comes to search record with optional parameter in SQL stored procedure, out of these two queries. Both return the same results. Considering performance, which one will you use and why? I have a stored procedure which has multiple search parameters and will be searching in multiple tables, with joins from a huge record set. DECLARE @EventName VARCHAR(100) --SET @EventName = '' --SET @EventName = NULL SET @EventName = 'Coffee in Coffee Bean' -- Query - 1 SELECT * FROM EventDetails WHERE