I have a new developer learning the ropes and who has created his first application with a simple CRUD interface. Before placing the app into production I wanted to make sure to retain the existing contents of the table that would be manipulated, because, you know, stuff happens. I went searching for a solution and came across this Technet article that exposed a beautiful mechanism for accomplishing this that I was not aware existed:
SELECT * INTO schema.new_table FROM schema.existing_table
And that’s it. This will create the brand new table (it cannot already be created) containing all of the information from the existing table.
Simple and elegant. Doesn’t get much better or easier than that.
Happy coding!