Giter Club home page Giter Club logo

sql's Introduction

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.

sql's People

Contributors

chadbaldwin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.