Parameters to a SQL View?
-
Hi everybody, I'm using MSSQL2005 to build a report system and I need to create some views in order to speed up the execution of queries, but I need these views created so that the WHERE clause contains dynamic values, like parameters or so. If I write this as a simple query, it would be as follows: SELECT some_field FROM my_table WHERE another_field = @my_parameter of course, the query I want turned into a view is much more complex, but the point here is the WHERE part and the use of a parameter. So, I'm wondering if there's a way of using the view somehow that I can specify this parameter. If anyone knows if this can be done and how to do it, please, let me know. Thanks in advance Cheers,
Kenia
-
Hi everybody, I'm using MSSQL2005 to build a report system and I need to create some views in order to speed up the execution of queries, but I need these views created so that the WHERE clause contains dynamic values, like parameters or so. If I write this as a simple query, it would be as follows: SELECT some_field FROM my_table WHERE another_field = @my_parameter of course, the query I want turned into a view is much more complex, but the point here is the WHERE part and the use of a parameter. So, I'm wondering if there's a way of using the view somehow that I can specify this parameter. If anyone knows if this can be done and how to do it, please, let me know. Thanks in advance Cheers,
Kenia