Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ktech
Starting Member
7 Posts |
Posted - 2014-02-10 : 13:31:15
|
Hi All,I just start working on company's SSRS reports. The people who created the reports have left. Now I need to added parameters @startdate and @enddate into the report.The current report use Stored Procedure as Datasets, the sp selected from a user defined function, the function selected from a view, in the view the date are using, now it is using getdate(). How can I add parameters for users to select the dates and pass the parameters to the view?Thanks a lot for any helps and suggestions!!! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-02-10 : 13:50:14
|
You would do it at the stored procedure level:create proc someproc(@var1 int, @var2 datetime)asset nocount onselect column1, column2from view1where somecolumn1 = @var1 and somecolumn2 = @var2Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
ktech
Starting Member
7 Posts |
Posted - 2014-02-10 : 20:52:39
|
Hi Tara,Thank you so much for your response!!But the dates are not used in the stored procedure, not even in the functions, they are used in the view. How can I pass the parameters through the stored procedure, function, then into the view? Or I must re-write the whole report?Thank you!! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-11 : 00:53:43
|
quote: Originally posted by ktech Hi Tara,Thank you so much for your response!!But the dates are not used in the stored procedure, not even in the functions, they are used in the view. How can I pass the parameters through the stored procedure, function, then into the view? Or I must re-write the whole report?Thank you!!
you must pass parameter to stored procedure and pass it down to function when you invoke it. Then inside function use that parameter in select statement using the view to filter the data from the view based on the passed values.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
ktech
Starting Member
7 Posts |
Posted - 2014-02-12 : 21:21:11
|
visakh16,Thanks a lot!!You are right, I must pass parameter to sp and function,not to view. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-13 : 08:15:58
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|