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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you alter a view from a stored procedure?

Status
Not open for further replies.

UrlOnz

Programmer
Dec 19, 2003
6
US
Can you alter a view from a stored procedure? I need to send criteria to the view from the parameter of the procedure.
I tried putting the ALTER VIEW code right after the AS in the CREATE VIEW statement. The error returned was “Error near key word VIEW”.
 
Let's start with the fact that you don't want to alter a view from a stored procedure if you have multiple users.

If you want to write a query with parmeters I suggest you use a stored procudre and just write the query without using the view at all (or only as the source of records for the query). There is no advantage that I can see to using a view in this case.
 
The thing is that I have something on the order of 40 users right now. No user can see the other useres data with the exception of the headquarters persons (2). The database front end is Access and the reports that the users need are based on the views that they can see. In reality none of the useres do much more than enter data in forms and then a case number when they want a report. I have that working on the front ends, but I would like to take any code out of the front ends. In other words only one person at a time would alter one of the views and then even if there were two people hitting the same view it would be almost imposible for them to hit at the same time since not more than two see the same view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top