I want to copy all tables, functions and stored procedures from a database to another in the same sql server 2008 instance. I am able to generate a script out of the source database but unable to run it programmatically (from another procedure). I have searched a lot on this, but unable to find an answer yet.
For now, I am just copying the sql code generated into a query window and executing it manually.