SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Drilldown parameters - Common Dates


Drilldown parameters - Common Dates

Author
Message
meichmann
meichmann
SSC-Addicted
SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)

Group: General Forum Members
Points: 405 Visits: 167
Hello everyone!
I'm hoping you all could help me with an issue....
I have a report with 3 parameters:

DateFunction
StartDate
EndDate

The DateFunction parameter retrieves values from a small table in a sql database:

Key Datetype
1 LastWeek
2 ThisWeek
3 LastMonth
etc....

So, want i want to do is have the user be able to select an option from the DateFunction parameter. The parameter will automatically send the key to a stored procedure that will figure out what calculations to do based on the key. I am assuming that I will have to call a function from the stored procedure since I need to return 2 values. Then I need the StartDate and EndDate parameters to automatically be populated with the values.

I hope I explained it good enough. If someone already has a function that does this, it would be greatly appreciated if you could upload it for me.

thanks for all your help!
sgmunson
sgmunson
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43228 Visits: 5422
To be honest, that table doesn't do enough for you to waste your time using it. You should probably create an inline table-valued function to completely replace that table. All the different date calculations can take place within the function, and the parameter to the function could either be the key you use currently or the other value in that table. The internals of the function could handle either method.

Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search