TRUNCATE and INSERT INTO SQL table DYNAMICALLY based on columns in SQL table.
I have a SQL table. See attached copy.
I have multiple companies in companyname column with each corresponding Select statements from each dbo. files table. Each company have exactly the same column fields. I want to insert each company "SelectFromTable" column into table in "InsertIntoTable" column dynamically. But before inserting into table, I want to delete the table first dynamically.
This is what I want to accomplish with the query:
Select "TrucateTable" , "InsertIntoTable" from dbo.DynamicTable