Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create view with parameter

Status
Not open for further replies.

nengie

Programmer
Jan 7, 2002
14
0
0
TH
Hi all,
I am new for SQL2000. I want to create view with parameter.
How can I do? TIA
 
Unfortunately you can't send a parameter to a view. Not sure what you are trying to achieve but perhaps writing a stored procedure could do what you want.

Rick.
 
Thanks for quick response.
I am VFP programmer. What I am trying to do is
create a View which criteria is variable, such like VFP view.
How can I do it in store procedure? Would you please guide me ?
 
This is a very simple stored procedure called upr_test which takes as an input parameter a of a customer number. The procedure then selects the address details from a table called ADDRESS based on this criteria.

CREATE PROCEDURE upr_test
@Customer_Num INT
AS
SET NOCOUNT ON
SELECT *
FROM ADDRESS
WHERE ADD_CUSTOMER_NUM = @Customer_Num


After the procedure has been created you can execute upr_test in the following manner where nnnnnn is the customer number of your choice.

exec upr_test nnnnnn

Rick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top