SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Reporting Services Development
 Input Box
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sureshprpt
Starting Member

India
32 Posts

Posted - 07/10/2012 :  05:34:48  Show Profile  Reply with Quote
Hi ,Is there any way to input the from to date for running the coding, instead for change the condition in the query.

For ex. In Visual basic , it will populated the input box to enter the value for the run the report.

Thanks
PS

Thanks & Regards
Suresh

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 07/10/2012 :  07:09:27  Show Profile  Reply with Quote
You can have parameters for the report and pass in those parameters to the query. So your query would remain the same, except it will be using the parameter it receives. MSDN has a tutorial on exactly this subject - filtering by date here
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 07/10/2012 :  12:40:47  Show Profile  Reply with Quote
you can make parameter type as datetime and reporting services interface will provide date picker for you in parameters to pick the date value

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sureshprpt
Starting Member

India
32 Posts

Posted - 07/11/2012 :  00:26:28  Show Profile  Reply with Quote
Can u send some example query please

regards
KPS

Thanks & Regards
Suresh
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 07/11/2012 :  07:18:44  Show Profile  Reply with Quote
Here is a simple example. First create a stored procedure in your database
CREATE PROCEDURE dbo.GetDateName
	@date DATETIME
AS 
	SELECT DATENAME(weekday,@date);
GO
Now use that in a report as the data set. You will have a parameter @date, for which you can select the date and the report will show the weekday name.

Now replace the contents of the stored proc with what your actual query is.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 07/11/2012 :  10:41:31  Show Profile  Reply with Quote
quote:
Originally posted by sureshprpt

Can u send some example query please

regards
KPS

Thanks & Regards
Suresh


try running the query Sunita gave in data tab of your report and when you click execute it will prompt for parameter value. give a test value and run it. it will populate grid with resultset. on refereshing it will automatically add the dataset information as well as the parameter to your report

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000