I`d like to find a script that will create a "create" script for an entire database. It would write a create-table script for every table in the database, complete with all the PKs and FKs too.

Since I`m asking for the world (or at least the world`s creation script), then I`d also like the script to (optionally) write insert statements for all the rows currently residing in all the tables.

Do you have such a script? If not, can you give me a couple of pointers to assist me in writing my own?

TIA