Real Time SQL Server Scripts

Scripts those can be used by SQL Server DBAs and SQL Server Developers on daily basis.

Data Analysis / Data Validation / Data Cleansing Scripts

  1. How to Search in all Columns for all tables in a database for Date Value in SQL Server
  2. How to Find Percentage of Null Values in every Column of all the Tables in SQL Server Database 
  3. How to Find Percentage of Empty or Blank Values in every Column of all the Tables in SQL Server Database
  4. How to Get Row Count Of All The Tables In SQL Server Database
  5. How to search for a String in all Columns in all tables in SQL Server Database
  6. How to find and Replace Text in all the columns in all the tables in SQL server Database
  7. How to find values with Leading or Trailing Spaces in SQL Server Table 
  8. How to Trim Leading and Trailing spaces for all the values in all the Columns in all the Tables in a SQL Server Database
  9. How to Find Duplicate Records in All the Tables in SQL Server Database
  10. How to Find & Delete Duplicate Records on All Tables in SQL Server Database
  11. How to Generate Select all Columns with or Without Top X Rows From All Tables Query Dynamically in SQL Server
  12. Concatenate SQL Server Columns for each Table Query Dynamically in SQL Server 
  13. How to List all Missing Identity Values for all Tables in SQL Server Database
  14. How to Find Max and Min Values for all the columns for all the tables in SQL Server Database
  15. How to get Record Count for all the tables in SQL Server Instance in SQL Server - SQL Server Tutorial
  16. How to get Maximum and Minimum Length for each Column Values for all the tables in SQL Server Database
  17. How to check if table exists in all databases in SQL Server

Server Level


Databases

  1. Changes to the state or options of database '' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.-Resolved
  2. How to put All User Databases to Single User Mode in SQL Server
  3. How to Set databases from SINGLE USER mode to MULTI USER Mode in SQL Server
  4. Generate Script To Detach All User Databases on SQL Server
  5. Get List of All Databases from SQL Server Instance
  6. Generate Script To Bring All User Databases Online in SQL Server
  7. Generate Script To Bring All User Databases Offline in SQL Server
  8. Generate Full Backup Scripts for all User Database in SQL Server
  9. How to backup all the databases from SQL Server Instance
  10. How to drop database in Single User Mode in SQL Server
  11. How to rename all the databases in SQL Server Instance
  12. How to remove String from Database Name in SQL Server ( Rename Database) 
  13. How To Get The Size of All Databases on SQL Server
  14. How To Change Recovery Mode To Simple For All Databases on SQL Server
  15. How to save result set of RESTORE FILELISTONLY in temp table in SQL Server
  16. How To Change Recovery Mode To Simple For All Databases on SQL Server
  17. How to take Transaction Log Backups for All SQL Server Databases in SQL Server
  18. How to take Differential backup of all the Databases on SQL Server Instance
  19. How to Drop or delete all User Databases on SQL Server Instance
  20. How to get Information about your Backups and Save into SQL Server Table
  21. How to Restore Databases from full backup files from a folder to SQL Server Instance
  22. How to recover databases which are in Restore status on SQL Server Instance
  23. How to Create 100's of Sample Databases by Script in SQL Server
  24. How to Change Recovery Model of Databases to Bulk_Logged in SQL Server
  25. How to Change Recovery Model to Full for all User Databases in SQL Server
  26. Backup Multiple Databases from Local and Linked Server (Compression Enabled) and Send Email Notification with time taken for each backup


SQL Server Agent Jobs

  1. Generate Scripts for Stored Procedures for Slowly Changing Dimensions Type 1 (TSQL Merge Statement Load SCD1)
  2. How to Load Slowly Changing Dimension Type 2 ( SCD2) By Using TSQL Merge Statement
  3.  Remove Database Name Or Some Text From Stored Procedures [ Cursor Example ]
  4. Alter Table Add Multiple Columns SQL Server
  5. How To Check When Object ( Table, Stored Procedure, Trigger etc) was Modified Last Time
  6. How To Check If Column Exists for SQL Table/ View in Database
  7. How to Find duplicate records in a SQL Server Table
  8. How To Delete All Duplicate Records From a SQL Server Table
  9. How To Keep One Record From Duplicate Records and Remove All Of Others From a SQL Server Table
  10. How To Find The Size Of a SQL Server Table
  11. How to Execute Large SQL Script File In SQL Server
  12. What is @@RowCount in SQL Server
  13. How To Execute Stored Procedure In View in SQL Server
  14. How to Get Row Count Of All The Tables In SQL Server Database
  15. How To Find Version of SQL Server
  16. How To Loop Through Users From a SQL Server Table And Send Email
  17. How To Change Recovery Mode To Simple For All Databases on SQL Server
  18. How To Send Email From SQL Server In HTML Format
  19. Truncate all the tables in a Database in SQL Server
  20. How to Get List of All Databases from SQL Server
  21. How to Disable/Enable DDL and DML Triggers in SQL Server
  22. How to Refresh View Definition by using sp_refreshview in SQL Server
  23. How to Disable/Enable All SQL Server Agent Jobs in SQL Server
  24. How to find if Table/View is used in Stored Procedure in SQL Server
  25. Get SQL Server Agent Jobs List with Schedule in SQL Server
  26. How to Get all Triggers with Table Names in SQL Server
  27. How to Drop or Delete all Triggers from a Database in SQL Server
  28. How to Create Trigger on Temp Tables and System Tables in SQL Server
  29. How to get list of All Disabled/Enabled Triggers in SQL Server Database
  30. How to Disable All the Triggers in SQL Server Database
  31. How to Enable Multiple Triggers in SQL Server Database
  32. How to get Decimal/Float Output from Integers Division in SQL Server
  33. Get all Tables with Column Names and Data types from SQL Server Database
  34. How to find String in All Stored Procedures in SQL Server Database
  35. How to get Table Names with Record Count in SQL Server Database
  36. How to Search Text in Steps of SQL Server Agent Jobs
  37. What are the different ways to set value of a Variable in TSQL
  38. How to Delete huge data from a SQL Server Table in batches
  39. How to Change Database Name inside Stored Procedure in SQL Server
  40. How to Determine if value is Numeric by using ISNumeric and Try_Convert Function
  41. How to Concatenate String and Integer Values in SQL Server
  42. How to Import Image File from File System to SQL Server Table
  43. How to Read Uncommitted Rows from SQL Server Table by using WITH (NOLOCK) Hint
  44. How to Add a Column with Values to Existing SQL Server Table
  45. How to Find Object ( Table.View,Stored Procedure,Function etc.) in All the Database in SQL Server 
  46. Generate Full Backup Scripts for all User Database in SQL Server
  47. Generate Scripts for Transactional Log Backups for All the User Databases on SQL Server
  48. How To Check If Column Exists for SQL Table/ View in Database
  49. How To Find Objects ( Stored Procedures, Views etc) In SQL Server Which Are Using Cross Database or Cross Server Queries
  50. How to find SQL Server Port number using T-SQL
  51. The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
  52. How to copy Some Tables or all Tables to Destination Database in SQL Server
  53. How to Compare two tables for Column Names in SQL Server
  54. How to Import or load Multiple XML files to SQL Server Table
  55. How to Import or load all the picture/image files from a folder to SQL Server Table by using TSQL
  56. How to Run Stored Procedure Against Multiple Databases in SQL Server