Skip to content
Navigation Menu
Toggle navigation
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
New
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
Accelerator
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search or jump to...
Search code, repositories, users, issues, pull requests...
Search syntax tips
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign in
Sign up
Appearance settings
Resetting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
exajobs
/
SQL-server-collection
Public
Notifications
You must be signed in to change notification settings
Fork
16
Star
40
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
main
Breadcrumbs
SQL-server-collection
/
Scripts
/
Copy path
Directory actions
More options
More options
Directory actions
More options
More options
Latest commit
History
History
History
main
Breadcrumbs
SQL-server-collection
/
Scripts
/
Copy path
Top
Folders and files
Name
Name
Last commit message
Last commit date
parent directory
..
Trace_Flag
Trace_Flag
Adding_Trace_Flags_To_Startup_Parameters.sql
Adding_Trace_Flags_To_Startup_Parameters.sql
AutoGuessingForeignKeyConstraints.sql
AutoGuessingForeignKeyConstraints.sql
Auto_Generate_Database_Documentation.sql
Auto_Generate_Database_Documentation.sql
Azure SQL Database Diagnostic Information Queries.sql
Azure SQL Database Diagnostic Information Queries.sql
Backup_Restore_What’s_My_Status.sql
Backup_Restore_What’s_My_Status.sql
Bad_Query_Example_13_JOINS.sql
Bad_Query_Example_13_JOINS.sql
Benchmark_TSQL.R
Benchmark_TSQL.R
Blocked_Session.sql
Blocked_Session.sql
Bufer_Cache_Info.sql
Bufer_Cache_Info.sql
BufferPoolExtension.sql
BufferPoolExtension.sql
Build_CREATE_TABLE_statement_using_dm_exec_describe_first_result_set.sql
Build_CREATE_TABLE_statement_using_dm_exec_describe_first_result_set.sql
CPU_Utilization.sql
CPU_Utilization.sql
CPU_Utilization_Graphical_form.sql
CPU_Utilization_Graphical_form.sql
Cached_Data_Per_Object_in_Memory.sql
Cached_Data_Per_Object_in_Memory.sql
Change_NonDefault_Collation_for_all_tables.sql
Change_NonDefault_Collation_for_all_tables.sql
CheckSpectreMeltdownStatus.sql
CheckSpectreMeltdownStatus.sql
Check_Reserved_Words_For_Object_Names.sql
Check_Reserved_Words_For_Object_Names.sql
Checking_Your_Backup_Paths_Exist_and_Automatically_Create_it.sql
Checking_Your_Backup_Paths_Exist_and_Automatically_Create_it.sql
Checkpoint_XE.sql
Checkpoint_XE.sql
Code_Reuse_With_Dynamic_SQL_and_Temp_Procedures_Example.sql
Code_Reuse_With_Dynamic_SQL_and_Temp_Procedures_Example.sql
Compare_2_tables_by_column_names.sql
Compare_2_tables_by_column_names.sql
Compress_Tables_And_Indexes.sql
Compress_Tables_And_Indexes.sql
Configure_SQL_Agent_Alerts.sql
Configure_SQL_Agent_Alerts.sql
Count character matches.sql
Count character matches.sql
Count_Database_Reads_and_Writes.sql
Count_Database_Reads_and_Writes.sql
Create_2_Million_Tables.sql
Create_2_Million_Tables.sql
Create_JOIN_Query_Between_Multiple_Tables_Dynamically.sql
Create_JOIN_Query_Between_Multiple_Tables_Dynamically.sql
Current_Running_Queries.sql
Current_Running_Queries.sql
Current_Running_Tasks_and_Server_Info.sql
Current_Running_Tasks_and_Server_Info.sql
DBCC_CHECKDB_Latest_date.sql
DBCC_CHECKDB_Latest_date.sql
Data_Dictionary_Information.sql
Data_Dictionary_Information.sql
Database_Mail_Configuration.sql
Database_Mail_Configuration.sql
Database_Mail_Problems.sql
Database_Mail_Problems.sql
Databases_Report.sql
Databases_Report.sql
Date_Calendar_Cross-Reference_Table.sql
Date_Calendar_Cross-Reference_Table.sql
Date_Format_Cheat_Sheet.sql
Date_Format_Cheat_Sheet.sql
Decrypt T-SQL module.sql
Decrypt T-SQL module.sql
Delete_Login_And_All_Users.sql
Delete_Login_And_All_Users.sql
DetermineSpaceWithinSQLDatabaseFiles.sql
DetermineSpaceWithinSQLDatabaseFiles.sql
Disable_Enable_All_Triggers_In_Database.sql
Disable_Enable_All_Triggers_In_Database.sql
Disabling_Jobs_Schedules.sql
Disabling_Jobs_Schedules.sql
Drop_all_objects_in_schema.sql
Drop_all_objects_in_schema.sql
Dynamic_GRANT_Generation.sql
Dynamic_GRANT_Generation.sql
DynamicallyGenerateDMAStatement.sql
DynamicallyGenerateDMAStatement.sql
Enable Microsoft.ACE.OLEDB.12.0.sql
Enable Microsoft.ACE.OLEDB.12.0.sql
Enabling_Jobs_Schedules.sql
Enabling_Jobs_Schedules.sql
Estimate_When_Long_Running_SQL_Processes_Will_Finish.sql
Estimate_When_Long_Running_SQL_Processes_Will_Finish.sql
Extract_Scale_Part_From_Decimal_Number.sql
Extract_Scale_Part_From_Decimal_Number.sql
Failed_SQL_Server_Agent_Jobs_With_Restart_Command.sql
Failed_SQL_Server_Agent_Jobs_With_Restart_Command.sql
Fast_alternative_to_sp_WhoIsActive.sql
Fast_alternative_to_sp_WhoIsActive.sql
FindDBConnectionLeaks.sql
FindDBConnectionLeaks.sql
FindLongRunningJobSteps.sql
FindLongRunningJobSteps.sql
FindTablesWithSimilarTableStructure.sql
FindTablesWithSimilarTableStructure.sql
Find_Foreign_Key_Chains_For_Tables.sql
Find_Foreign_Key_Chains_For_Tables.sql
Find_Maximum_Float_Values.sql
Find_Maximum_Float_Values.sql
Find_Non_Sargable_Queries.sql
Find_Non_Sargable_Queries.sql
Find_Not_Used_Legacy_Tables.sql
Find_Not_Used_Legacy_Tables.sql
Find_Object_Dependecy.sql
Find_Object_Dependecy.sql
Find_SQL_Server_Integer_Columns_to_Make_Skinnier.sql
Find_SQL_Server_Integer_Columns_to_Make_Skinnier.sql
Find_Status_of_SQL_Server_Statistics.sql
Find_Status_of_SQL_Server_Statistics.sql
Find_Synonyms_for_nested_objects_in_the_different_databases.sql
Find_Synonyms_for_nested_objects_in_the_different_databases.sql
Find_Synonyms_for_nested_objects_in_the_same_database.sql
Find_Synonyms_for_nested_objects_in_the_same_database.sql
Find_Weak_Passwords.sql
Find_Weak_Passwords.sql
Find_and_fix_that_troublesome_Windows_Power_setting.sql
Find_and_fix_that_troublesome_Windows_Power_setting.sql
FindingImplicitColumnConversionsInPlanCache.sql
FindingImplicitColumnConversionsInPlanCache.sql
FindingSpecificColumns.sql
FindingSpecificColumns.sql
Finding_Blocking_Queries.sql
Finding_Blocking_Queries.sql
Finding_Host_Names_for_Failed_login_attempts.sql
Finding_Host_Names_for_Failed_login_attempts.sql
Fix_The_Broken_Dependencies_On_All_Objects.sql
Fix_The_Broken_Dependencies_On_All_Objects.sql
Foreign_Key_batch_rename.sql
Foreign_Key_batch_rename.sql
Foreign_Keys_With_No_Index.sql
Foreign_Keys_With_No_Index.sql
GenerateTSQLTimeSlices.sql
GenerateTSQLTimeSlices.sql
Generate_BIML_Script.sql
Generate_BIML_Script.sql
Generate_Restore_Script_From_Backup_Folder.sql
Generate_Restore_Script_From_Backup_Folder.sql
Generate_table_definition_to_match_query.sql
Generate_table_definition_to_match_query.sql
GetResourceNameFromBlockedProcessReport.sql
GetResourceNameFromBlockedProcessReport.sql
Get_Amazon_RDS_Instance_Size.sql
Get_Amazon_RDS_Instance_Size.sql
Get_CPU_Usage_Per_Database.sql
Get_CPU_Usage_Per_Database.sql
Get_Coulmn_Statistics_By_Name.sql
Get_Coulmn_Statistics_By_Name.sql
Get_Create_or_Alter_Index_Progress.sql
Get_Create_or_Alter_Index_Progress.sql
Get_Database_Size_With_Graph.sql
Get_Database_Size_With_Graph.sql
Get_Identity_Column_Information.sql
Get_Identity_Column_Information.sql
Get_Latest_Success_and_Failure_Login.sql
Get_Latest_Success_and_Failure_Login.sql
Get_Opened_Transactions_Info.sql
Get_Opened_Transactions_Info.sql
Get_SQLServer_Startup_Parameters.sql
Get_SQLServer_Startup_Parameters.sql
Get_SQL_Server_Agent_Information.sql
Get_SQL_Server_Agent_Information.sql
Get_SQL_Server_Backup_Directory.sql
Get_SQL_Server_Backup_Directory.sql
Get_SQL_Server_NUMA_Memory.sql
Get_SQL_Server_NUMA_Memory.sql
Get_Statistics_Details.sql
Get_Statistics_Details.sql
Get_Table_Hierarchy.sql
Get_Table_Hierarchy.sql
Get_Table_and_Index_Storage_Size.sql
Get_Table_and_Index_Storage_Size.sql
Get_latches_Objects.sql
Get_latches_Objects.sql
GoogleJobTimeline.sql
GoogleJobTimeline.sql
How_much_will_it_cost_or_save_to_rebuild_that_index.sql
How_much_will_it_cost_or_save_to_rebuild_that_index.sql
How_old_your_backups.sql
How_old_your_backups.sql
How_to_Find_Queries_Using_an_Index.sql
How_to_Find_Queries_Using_an_Index.sql
How_to_obtain_the_deadlocks_on_Azure.sql
How_to_obtain_the_deadlocks_on_Azure.sql
IN_Memory_Example_2014.sql
IN_Memory_Example_2014.sql
IN_Memory_Example_2017.sql
IN_Memory_Example_2017.sql
View all files
README.md
Usefull SQL Server Scripts
More than 100 useful scripts for SQL Server
You can’t perform that action at this time.