"Benito" <be*******@juno.com> wrote in message
news:5c**************************@posting.google.c om...
Hi Everyone,
Is there an easy way that I could pass a filter (variable) unto a view
via stored procedures? I would appreciate your suggestions.
Benito
Views cannot take parameters, but if you are using MSSQL 2000, then a
table-valued UDF is one solution:
create function dbo.MyFunc (@parm int)
returns table
as
return (
select col1, col2
from dbo.MyTable
where idcol > @parm
)
select col1, col2 from dbo.MyFunc(5)
There are examples in Books Online. If you have an earlier version of MSSQL,
then you'll have to use a stored procedure.
Simon