I have a database with many tables, and each table has many columns. There are also many indecies and primary keys.
From program control, I need to make a copy of the database (replicate the tables, columns, indecies, keys, etc.) with the copy having a different database name.
I would like to have a stored procedure that can copy the database, but I do NOT want to hard code all of the table names, columns, etc. into the stored procedure. I want the stored procedure to get the table names, column names, column data types, etc. from the original database. In this way, I can make changes to the original database, and I will not have to make changes to the stored procedure.
Is this possible? How is it done?
Thank you, in advance, for your help.