Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevehansen/sql-inliner
Helper utility to inline SQL server database views
https://github.com/stevehansen/sql-inliner
sql
Last synced: 3 months ago
JSON representation
Helper utility to inline SQL server database views
- Host: GitHub
- URL: https://github.com/stevehansen/sql-inliner
- Owner: stevehansen
- License: mit
- Created: 2021-05-11T15:24:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-18T20:18:28.000Z (4 months ago)
- Last Synced: 2024-10-05T11:43:05.962Z (3 months ago)
- Topics: sql
- Language: C#
- Homepage:
- Size: 79.1 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# sql-inliner
Helper utility to inline SQL server database views> **Always verify the generated code manually before deploying to a production database**
## Example usage
``sql-inliner -cs "Server=.;Database=Test;Integrated Security=true" -vn "dbo.VHeavy" --strip-unused-joins``
Will fetch the definition of the VHeavy view from the Test database and recursively inline each non-indexed view that it detects while stripping unused columns (defaults to true) and unused joins (both inner and outer) for performance reasons.
The application will output the new create or alter view statement that can be used on the database.The generated statement will include a starting comment containing the original statement (can be used to restore the original code) which is also used when the view is reused in other views to start working from the original statement.
Other included information will be the different views that were used, how many select columsn and joins that were stripped.## Verifying the generated code
**Always** verify the SQL by comparing it with the old code.
```sql
select * from dbo.VHeavy except select * from dbo.VHeavy_v2
select * from dbo.VHeavy_v2 except select * from dbo.VHeavy
```Should return 0 results for both queries.