Skip to content

Generate a complete set of SQL scripts for a Microsoft SQL Server database/schema including tables, views, functions, triggers, and stored procedures.

License

Notifications You must be signed in to change notification settings

binbash23/mssql_generate_schema_scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

mssql_generate_schema_scripts

Generate a complete set of SQL scripts for a Microsoft SQL Server database/schema. The generated scripts include table, view, function, trigger and stored procedure definitions. Also indices, column store table stuff, ... are included.

Written 2025 by jens heine <binbash@gmx.net>

Usage   : export_schema_definition.ps1 MSSQLSERVER_NAME DB_NAME SCHEMA_NAME EXPORT_PATH
Notes   : Run this tool in an administrator powershell.
          You can exclude/include the object types to export in the top of the script.
Example : .\export_schema_definition.ps1 sql-server my_database dbo c:\temp

If you only want to generate scripts for stored procedures i.e. and no other objects, edit the header variables in the script and set them to $true or $false:

...
# Select object types to export
$export_views = $true
$export_tables = $true
$export_functions = $true
$export_db_triggers = $true
$export_table_triggers = $true
$export_stored_procedures = $true
...

As a result you get 6 files including the sql scripts for the database objects (tables, views, ...) and a summry report how many objects of each type have been generated.

Please post comments, feature requests and/or bugs.

Best regards, Jens

About

Generate a complete set of SQL scripts for a Microsoft SQL Server database/schema including tables, views, functions, triggers, and stored procedures.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published