Skip to content

Useful SQL Server scripts/SPs for DBA or SQL Developers that I use and/or have created

License

Notifications You must be signed in to change notification settings

EmanueleMeazzo/tsql.tech-Code-snippets

Repository files navigation

tsql.tech Code snippets

List of contents:

  • DMV (Estract useful informations from DMVs)

    • Availability Groups information
    • Find Active Locks
    • Find Key Lookup in Plan Cache
    • Find Long Running Queries in PlanCache
    • Find Most Expensive Queries in PlanCache
    • Find Plans of your query in PlanCache
    • Find implicit Conversion Queries in PlanCache
    • Measure IO Latency and Throughput in a period of time
    • Index Usage Statis
    • LatchesStats
    • SpinlockStats
    • Table Sizes
    • Waitstats
  • Dynamic SQL

    • Execute and Track the performance and behavior of Dynamic SQL Statements REFERENCE ARTICLE
  • Extended Events

    • Backup-Restore duration troubleshoot
    • Capture Plans with warning
  • Functions

    • DelimitedSplit8K - The powerful splitting function by Jeff Moden
    • fn_KeepInString - Keep only certain values in a sting See Article
    • fn_RemoveFromString - remove certain patterns from a string See Article
    • fn_TrasposeString - Trasposes strings into tables See Article
  • Maintenance

  • Notebooks

  • PowerBI

  • PowerShell

    • Covert Notebook to HTML - Converts a Jupyter Notebook to HTML for easy export [Requires jupyter installed in the System]
    • Create Diagnostic Notebooks - Automatically creates Jupyter Notebooks from the Latest Glen Berry Diagnostic Queries
    • Create FirstRespodersKit notebook - Automatically creates Jupyter Notebooks from the Latest FirstRespondersKit scripts
    • Export to CSV - A sample, simple, export SQL Table to CSV file using SQLServer Powershell Modules
    • PIP upgrade all packages - A simple way to upgrade all the installed Python packages using PIP
  • QueryStore

    • Query Tuning Reccomandations
    • QueryStore_Duration
  • Schema-Related

    • Bulk Move Schema
    • Find Column by name
    • Find Stored Procedure
    • Find primary key candidates
  • Session Materials

    • How to use PowerBI as a Monitoring Tool (Slides and Report examples)
  • Troubleshooting

  • Views

    • BlitzCache_MissingIndexesView - Filters the BlitzCache historic table for misssing indexes reports
    • JobAndSchedules - Shows SQL Agent Jobs and Schedules, by M.Pearson