Good morning everyone. I have a query that isn't behaving like I want. The query is to be used in an SSRS report. I want the query to return all records if nothing is selected for a start and end date. The way I have it now nothing shows up if the begin and start dates aren't supplied. Can someone please take a look at the below SP and show me how to alter it so that all records are returned if the start and end dates are omitted? Or maybe my approach is wrong and someone can point me in the right direction?USE [mybookstore]GO/****** Object: StoredProcedure [dbo].[GetSales] Script Date: 5/15/2014 9:26:50 AM ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================CREATE PROCEDURE [dbo].[GetSales]( @pBeginDate DateTime = NULL, @pEndDate DateTime = NULL)ASBEGINselect H.InvID, H.OrdDate, H.ExpDate, H.PoNumber, H.CustNumber, H.ShippedDate, D.InvPk, D.ProductID, D.Quantity * D.UnitPrice as Sales, S.SalesRepNumber, S.FullName, C.CustNamefrom InvHeader H inner join InvDetails D on H.InvID = D.InvIDinner join Customers C on H.CustNumber = C.CustNumberinner join SalesRep S on C.Salesperson = S.SalesRepNumberwhere H.ShippedDate IS NOT NULLand (H.ShippedDate BETWEEN (@pBeginDate) AND (@pEndDate))END