Using Scripts for SQL Server Database Creation

How can I export scripts to create the nonsystem tables and stored procedures of a Microsoft SQL Server database?
SQL Server has an option that lets you create scripts for database creation, including designing tables and stored procedures. To access this feature, perform these steps:

  1. Start the Enterprise Manager (Start, Programs, Microsoft SQL Server, Enterprise Manager).
  2. Expand Microsoft SQL Servers, SQL Server Group (local) (Windows NT), Databases.
  3. Right-click the desired database and select All Tasks, Generate SQL Script, as Figure 1 shows.
  4. Under the General tab, click the Show All button and select the All tables and All stored procedures checkboxes shows.
  5. Click OK.
  6. You'll be prompted for the name of a SQL extension file to save the content to and click Save.
  7. Click OK at the completion dialog box.

The file that this process generates will contain the SQL code necessary to create the objects selected.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.