https://github.com/binbash23/mssql_generate_schema_scripts
Generate a complete set of SQL scripts for a Microsoft SQL Server database/schema including tables, views, functions, triggers, and stored procedures.
https://github.com/binbash23/mssql_generate_schema_scripts
database database-management generate-schema-script microsoft mssql mssql-database mssqlserver script sql sqlserver
Last synced: 10 months ago
JSON representation
Generate a complete set of SQL scripts for a Microsoft SQL Server database/schema including tables, views, functions, triggers, and stored procedures.
- Host: GitHub
- URL: https://github.com/binbash23/mssql_generate_schema_scripts
- Owner: binbash23
- License: mit
- Created: 2025-03-12T13:08:56.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-03-12T14:05:39.000Z (10 months ago)
- Last Synced: 2025-03-12T14:23:16.108Z (10 months ago)
- Topics: database, database-management, generate-schema-script, microsoft, mssql, mssql-database, mssqlserver, script, sql, sqlserver
- Language: PowerShell
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
Usage : export_schema_definition.ps1 MSSQLSERVER_NAME DB_NAME SCHEMA_NAME EXPORT_PATH
Notes : Run this tool in an administrator powershell.
The export path does not allow spaces.
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
...
```
Please post comments, feature requests and/or bugs.
Best regards, Jens