I\'m using MS SQL Server, and I\'d like to alter a view from within a stored procedure, by executing something like \"alter view VIEWNAME as ([some sql])\".
A few pa
I think the answers are:
An alternative approach might be to have a separate table (called something like swing_table) with either 1 or 0 records to indicate whether the view should query the production or other (backup?) table respectively - something like:
create view viewname as
select {field list}
from production_table
cross join swing_table
union all
select {field list}
from backup_table
where (select count(*) from swing_table) = 0
- then TRUNCATE swing_table within the procedure when you want to, erm, swing the table - since TRUNCATE is not a transactional command, it should execute immediately.