Say I have a database called MyDB with 100 tables. I need to create these tables on another db. Is there a TSQL script that will return the create table scripts for all tables on MyDB?
In SSMS you can right click on the database and use Tasks-> Generate Scripts...
That will give you plenty of options to generate the scripts for all or some of the objects of your database.
Luis C. General Disclaimer: Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?
How to post data/code on a forum to get the best help: Option 1 / Option 2