Link to home
Start Free TrialLog in
Avatar of PeterMatthews
PeterMatthews

asked on

Using ALTER VIEW from within a stored procedure

Im looking to fire a stored procedure one per day.  It retrieves the primary key of records that have been added in the last 30 days. Im then looking to ALTER VIEW so that the view filters for records where the primary key is greater than the one just retieved.
Having issues with ALTER VIEW needing to be the first statement.
Using the PK opposed to just using date criteria is required for speed.
Avatar of urban_smurf
urban_smurf
Flag of Australia image

Perhaps
"CREATE OR REPLACE VIEW"
is a better strategy. You could try it.

From the manual:
This statement creates a new view, or replaces an existing
one if the OR REPLACE clause is given. If the view does
not exist, CREATE OR REPLACE VIEW is the same as CREATE
VIEW. If the view does exist, CREATE OR REPLACE VIEW is
the same as ALTER VIEW.
Avatar of PeterMatthews
PeterMatthews

ASKER

Sorry only put on the tags that Im using SQL 2000 which doesnt appear to support this.
ASKER CERTIFIED SOLUTION
Avatar of ralmada
ralmada
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great that will do fine, thanks.