Is it possible in MS SQL Server 2008
to export database structure into a T-SQL
file?
I want to export not only tables schema but also primary keys, foreign keys, constraints, indexes, stored procedures, user defined types/functions.
Also I don't want the data to be present in this T-SQL
file.
Is there any way to achieve that?
You can generate scripts to a file via SQL Server Management Studio, here are the steps:
When generating the scripts, there is an area that will allow you to script, constraints, keys, etc. From SQL Server 2008 R2 there is an Advanced Option under scripting: