Suppose I have to two tables, Employees
and Departments
- both are linked via pk and fk.
I have created a view myview
and I want to trigger an event at 12:00 Am and create a new table and copy data from the view into new table.
Suppose I have to two tables, Employees
and Departments
- both are linked via pk and fk.
I have created a view myview
and I want to trigger an event at 12:00 Am and create a new table and copy data from the view into new table.
Assuming there is no table already, you can query directly into the table from the view with this:
SELECT *
INTO #NEWTABLE
FROM YOURVIEW
I believe you can do the following:
CREATE TABLE <table_name> AS (
SELEC *
FROM myview
)