4

Possible Duplicate:
How can I automate the "generate scripts" task in SQL Server Management Studio 2008?

I need to export structure of my SQL Server database into a .sql script(s) without management studio.

UPDATED

Community
  • 1
  • 1
hazzik
  • 13,019
  • 9
  • 47
  • 86
  • 1
    You could use a third-party tool like [ApexSQL SQL Script](http://www.apexsql.com/sql_tools_script.aspx) to achieve this... `bcp` is really more for the **data** import/export (rather than the database's structure) – marc_s Aug 13 '11 at 19:48

2 Answers2

15

In SQL Management Studio:

  • Right click on Database entry
  • In menu select Task -> Generate Scripts
  • Specify what exacly you want to generate (schema only, +functions, +stored procedures,..)
sll
  • 61,540
  • 22
  • 104
  • 156
4

Try out Tasks -> Generate scripts menu in SQL Management Studio

xelibrion
  • 2,220
  • 1
  • 19
  • 24