I wrote inline SQL in a C# .NET application but it is timing out so I am creating a SPROC in sql server.
I need to pass in a parameter for the purpose of dynamically determining the where clause. Any idea how to do this?
As an example - lets say I am passing in CheckDate as BIT, dtStart and dtEnd.
If CheckDate = 0 then
Where MyDate > '1/1/13'
if CheckDate = 1 and the dtStart = '5/1/13' and dtEnd IS NULL
Where MyDate >= '5/1/13'
if CheckDate = 1 and the dtStart = '5/1/13' and dtEnd = '5/31/13'
Where MyDate >= '5/1/13' and MyDate <= '6/1/13'