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
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 pass parameter to view
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

inbs
Aged Yak Warrior

836 Posts

Posted - 06/13/2013 :  14:26:36  Show Profile  Reply with Quote
how can i pass paramerter (time) from reporting server to my db
i mean, i have report in reporting, and his dataset is very simple

select * from V_Test

my view in the DB ,and in the where i have :
where datevalue < GETDATE()

i want that GETDATE(), will be parameter.

how can i do it?

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 06/14/2013 :  00:50:00  Show Profile  Reply with Quote
make the query like

select * from V_Test where datevalue < @date


on running this in report data tab it will prompt for the value. give a suitable value,run query to get results. Then refresh the dataset. field as well as parameters will be added automatically to report.
You can right click on left top corner of report in design tab and choose report parameters and it will show parameters tab where you can change the properties of the created parameter like datatype,default value etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

inbs
Aged Yak Warrior

836 Posts

Posted - 06/14/2013 :  06:25:04  Show Profile  Reply with Quote
thanks but,
i want to pass this parameter to the view

i mean in the view i want to add this
where datevalue < @date

(because i do not bring to SELECT this datevalue field)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 06/14/2013 :  06:41:24  Show Profile  Reply with Quote
quote:
Originally posted by inbs

thanks but,
i want to pass this parameter to the view

i mean in the view i want to add this
where datevalue < @date

(because i do not bring to SELECT this datevalue field)


you cant pass parameter to a view. Its like a virtual table.
If you want to make query parameterized then it should be a stored procedure/function and not a view.
For SSRS, best would be to use stored procedure as backend with your required parameter

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
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.09 seconds. Powered By: Snitz Forums 2000