Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chadbaldwin/sql
Various SQL stuff I'm working on...tools, scripts, etc
https://github.com/chadbaldwin/sql
ms-sql ms-sql-server ms-sqlserver mssql mssqlserver sql sql-query sql-server sqlserver stored-procedure stored-procedures storedprocedure
Last synced: about 1 month ago
JSON representation
Various SQL stuff I'm working on...tools, scripts, etc
- Host: GitHub
- URL: https://github.com/chadbaldwin/sql
- Owner: chadbaldwin
- License: mit
- Created: 2019-05-21T22:57:09.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-27T05:22:03.000Z (3 months ago)
- Last Synced: 2024-09-29T14:21:34.968Z (about 2 months ago)
- Topics: ms-sql, ms-sql-server, ms-sqlserver, mssql, mssqlserver, sql, sql-query, sql-server, sqlserver, stored-procedure, stored-procedures, storedprocedure
- Language: TSQL
- Homepage:
- Size: 282 KB
- Stars: 18
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SQL
Various SQL stuff I'm working on...tools, scripts, etc- **dbo.uf_DateCalc.UserDefinedFunction.sql** - Returns common date ranges based on today or a supplied seed date. Useful for reporting.
- You can either use this as a view by not supplying a DateCode parameter and getting a list of all possible ranges. I like to use this for things like populating drop downs in SSRS.
- Or you can supply a specific DateCode to only get a single record back. I like to use this in procs as an easy to read way of indicating the time range for that proc. It just makes for more readable code.- **dbo.uf_DateRange.UserDefinedFunction.sql**
- **dbo.usp_SchemaSearch.StoredProcedure.sql**
- A few of the features include...
- Multiple search criteria (`@Search`, `@ANDSearch`, `@ANDSearch2`)
- (AND joins only)...search "this" AND "that"
- Partial and exact match option (`@WholeOnly`)
- If `@WholeOnly` = true, similar to "match whole word", applies to all search parameters
- Searches all object types...triggers, functions, procs, views, etc
- Output the physical file path of the item (`@BaseFilePath`)
- This makes it easy to quickly open the actual file
- Example CTRL+C, CTRL+O, CTRL+V, Enter...I have a keyboard macro set up for it
- As of now...it only supports one convention for file paths and names, which is the one I use...I hope eventually, I can add some functionality to make that configurable.
- 2nd level of depth (`@FindReferences`)
- Ability to find all the references to your search results
- Example...you search for a keyword, the proc will return all procs that contain that keyword. You can then go one level deeper and enable @FindReferences, this will find all objects that reference those objects.
- Limitations - only finds references for stored procedure results, and it only searches other stored procedures and job steps
- Result caching (`@CacheObjects`, `@CacheOutputSchema`)
- Many times if you are using this heavily to trace a large process, you may not want to hit every database to grab every object every time you run this proc. So there is an option to cache all objects into a temp table. This way each run, only the temp table is searched. You can also query the temp table manually for more complex searches of your own.
- DB filter lists (`@DBName`, `@DBIncludeFilterList`, `@DBExcludeFilterList`)
- The ability to provide both and inclusion and exclusion list of database name filters (using LIKE syntax, comma delimited)
- For example...if you want to exclude all databases with '%test%,%backup%'. That will exclude all databases that have "test" or "backup" in the name
- `@DBName` - included for simplicity / legacy but will likely be removed eventually. It's an exact match parameter. Filters the proc to only look at the one database, and is an exact match.