all groups > sql server new users > july 2006 >
You're in the

sql server new users

group:

View with parameter?


Re: View with parameter? Keith Kratochvil
7/17/2006 9:26:31 AM
sql server new users:
No, it is not possible.

You would need to use the parameter when you query the view
OR
you could create a stored procedure (that performs a select and accepts a
paremeter).


--
Keith Kratochvil


[quoted text, click to view]

Re: View with parameter? Vikram Vamshi
7/17/2006 12:38:23 PM
"Inline User Defined Functions"
Will do exactly what you are looking for.
http://msdn2.microsoft.com/en-us/library/ms189294.aspx

Works in sql2k and sql2k5
hth
--
Vikram Vamshi
Database Engineer
Eclipsys Corporation
[quoted text, click to view]

View with parameter? MarcVS
7/17/2006 3:01:49 PM
I'm trying to make a view in SQL Server 2005 with a parameter (WHERE ID =
@param)

I open the view, and put the = @param in the Filter column. I get an error:
'Parameters' cannot be used in this query type
When I click OK, SQL server leaves the statement in the column and puts
'WHERE (dbo.Postcodes.postcode = @param)' in the SQL statement. When I try
to save it I get an error: 'Must declare the scalar variable @param'

My question(s):

Is it possible to make a view with a parameter? How? Where do I declare the
parameter?

Marc

AddThis Social Bookmark Button