Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
groston
Yak Posting Veteran
61 Posts |
Posted - 2004-11-11 : 15:33:33
|
| I need to write a stored procedure that takes as its only input the name of a new database that is to be created, creates this database, and then copies three table schemas (no data) and three stored procedures from the current DB into the new DB. Both DB's reside on the same instance of SQL Server.One way would be to use select from INFORMATION_SCHEMA into a CREATE TABLE. (But, I am not sure how to deal with the primary key on one fo the tables.) I also figured out how to extract the text of the SP's from syscomments, but haven't figured out how to create the new SP's.I would like to "cheat" as little as posisble, i.e., I would like to minimize the amount of knowledge I have about the tables. For example, I know that only one table has a PK and which column is hte PK column, but this is major league cheating! However, I am perfectly willing to specifically identify the names of the three tables and three SP's that I want copied.Would you kindly point me in the right direction.Thank you. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-11-12 : 00:13:00
|
| How about doing the copy via dmo?http://www.nigelrivett.net/SQL-DMOTransfer.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|