Blindly Copy SQL Database

Another quick SQL note; a side-effect of some earlier searching.

It ought to be possible to copy all columns in all tables in a given database in a completely generic way. For creating quick testing environments using current data, this could be handy.

Table information: SELECT * FROM INFORMATION_SCHEMA.TABLES order by Table_Name

Column information SELECT * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'table_name'

I just have to get around to writing the loop logic the iterates over each table and extracts its column list for a dynamic SQL statement using the earlier table copying script. If I get around to this, I will post a followup.

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.001. Contact Blog Owner