SQL Create Table Scripts Automatically

Using SQL Management Studio, I know you can right-click a table -> Script table as -> Create To -> New Query Editor Window and then I can save that as a .sql file but how can I automate this?

For example, when I start a new project, I want to be able to run a script that will generate all of the table creation scripts for me so I can back them up in the documentation folder.
Who is Participating?
Atdhe NuhiuCommented:
You can right click the database -> tasks-> generate scripts

this allows you to choose to script all tables . Not quite automatic but perhaps would help
twcadminAuthor Commented:
This is very automatic. I was able to choose an options to create a new file for each object. It's not scriptable as far as I know but accomplishes when I am trying to do! Thanks!
Atdhe NuhiuCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.