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 |
|
dordor
Starting Member
5 Posts |
Posted - 2011-07-20 : 10:28:42
|
| I'm trying to create a new 'View', and adding the expressions into the 'Column' name to calculate the result for the field, eg:CASE WHEN CreationDate BETWEEN @StartDate AND @EndDate THEN 1 ELSE 0 ENDThis works fine in a query. I'm able to save the View also. When I execute the View, it asks me to enter the parameters for @StartDate and @EndDate. No matter what I enter, I get an error saying "The parameter is incorrect." If I replace the variables with a hard-coded date, it works fine, but never by plugging in parameters.Any ideas how to make this work? |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-07-20 : 10:41:32
|
| Views cannot take parameters, they're single select statements, nothing more. Not sure how you're able to save that view, if I try saving a view with a parameter I get an errorMsg 137, Level 15, State 2, Procedure test, Line 3Must declare the scalar variable "@StartDate".--Gail ShawSQL Server MVP |
 |
|
|
dordor
Starting Member
5 Posts |
Posted - 2011-07-20 : 11:15:24
|
| Thank you for your response |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-07-21 : 04:18:26
|
| dordor which editor where you using for creating view?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|