ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Passing multiple NULL and Value to Where clause in SQL Server<p>Hi&nbsp;nauna,</p> <p>For this you have to check the input parameter with <strong>IS NULL</strong> condition.</p> <p>Check this sample query and correct your query based on your table structure.</p> <p><strong><span style="text-decoration: underline;">Database</span></strong></p> <p>For this example I have used of Northwind database that you can download using the link given below.</p> <p><a href="https://www.aspsnippets.com/Articles/Install-Microsoft-Northwind-and-Pubs-Sample-databases-in-SQL-Server-Management-Studio.aspx" target="_blank">Download Northwind Database</a></p> <p><strong><span style="text-decoration: underline;">SQL</span></strong></p> <pre class="brush: sql">DECLARE @OrderId INT, @EmployeeId INT, @ShipVia INT SET @OrderId = NULL SET @EmployeeId = 6 SET @ShipVia = 1 SELECT OrderID,EmployeeID,ShipVia,Freight,ShipCity FROM Orders WHERE (OrderID = @OrderId OR @OrderId IS NULL) AND (EmployeeID = @EmployeeId OR @EmployeeId IS NULL) AND (ShipVia = @ShipVia OR @ShipVia IS NULL)</pre>https://www.aspforums.net:443/Threads/376409/Passing-multiple-NULL-and-Value-to-Where-clause-in-SQL-Server/https://www.aspforums.net:443/Threads/376409/Passing-multiple-NULL-and-Value-to-Where-clause-in-SQL-Server/Tue, 25 Jun 2019 00:43:18 GMT