How can I save the schema of a SQL Database to a file?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-05-15T00:46:46Z Indexed on 2010/05/15 0:54 UTC
Read the original article Hit count: 254

I'm writing a software application in C#.Net that connects to a SQL Server database. My C# project is under SVN version control, but I'd like to include my database schema in the SVN repository as well. An answer to a previous question of mine suggested storing the scripts to generate the database in version control. Is there a way to automatically generate these scripts from an existing database?

I'm very new to SQL Server, but I noticed in management studio that the SQL commands to create a table can be generated automatically by right clicking on the table and clicking "Script Table As". Is there an equivalent command that would work with the entire database?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql-server-management-stu