I’m looking for a way to automatically create a 1:1 view per table for a bunch of tables.
Since there are plenty of tables for which I need a view, it would be time-consuming to create them manually.
Perfect scenario would be a query creating the create view queries for each table given at once.
This should do the trick for the current database. It’s still dynamic SQL, but… Note that it does not check to see if the views already exist. You can add a
WHEREclause to the cursor query to limit the tables –WHERE t.name = '...'orWHERE t.name IN ('...','....').