August 29, 2006 at 2:14 am
Hi
I already have a stored procedure which looks like this
if @Category = 'PD'
Begin
if @Type = 'Submission Date'
Begin
SELECT *
FROM TABLEA
WHERE SubmissionDate BETWEEN @StartDate AND @EndDate
End
if @Type = 'Initial Approval Date'
Begin
SELECT *
FROM TABLEB
WHERE InitialApprovalDate BETWEEN @StartDate AND @EndDate
End
End
But if i have many more If statements can i use a Select Case as in my .net application to query the stored procedure by passing the appropriate value and let the stored procedure to execute the appropriate query and send back the result?
Can someone help me on that ?
Thanks for your kind help
Cheers
August 29, 2006 at 6:46 am
You can do something like this :
if ...
exec dbo.Proc1
else
exec dbo.Proc2
...
That'll always return a single recordset and it's the server that controls what has to be executed... which is a really good thing .
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply