- Create a SQL database
- Create a couple of tables
- Create a view that queries those tables and make sure to include a calculated column
- Create an empty table from the view using SELECT INTO...WHERE 1=0
- Drop the view
- Rename the empty table to the name of the dropped view
- Try and insert some data into the table
- Scratch your head...
Yup, SQL still thinks the object with the same name is a view and because it includes a calculated column it won't let you insert data into it.
To solve the issue, execute the sp_refreshview proc using the name of the new table.
To solve the issue, execute the sp_refreshview proc using the name of the new table.