Posts

Showing posts from November, 2020

Normal Forms

https://www.red-gate.com/simple-talk/sql/sql-development/normalforms  

Virtual Log Files

https://dallasdbas.com/virtual-log-files  

Stairway to Row Level Security

https://www.sqlservercentral.com/stairways/stairway-to-row-level-security  

Efficient Solutions for Gaps and Islands Analysis

https://www.red-gate.com/simple-talk/sql/t-sql-programming/efficient-solutions-to-gaps-and-islands-challenges  

Stairway to SQL Server Extended Events

  https://www.sqlservercentral.com/stairways/stairway-to-sql-server-extended-events

SQL Server Rounding Functions - Round, Ceiling and Floor

https://www.mssqltips.com/sqlservertip/1589/sql-server-rounding-functions--round-ceiling-and-floor/  

T-SQL RegEx Commands

  https://www.sqlshack.com/t-sql-regex-commands-in-sql-server/

Queue SSRS Report Subscriptions

 T-SQL script to "queue" up SSRS report subscriptions (from my colleague Mark Horninger): DECLARE @sql varchar(max);   set @sql = '';   select @sql = @sql + 'exec ReportServer.dbo.AddEvent @EventType=''TimedSubscription'', @EventData='''   + cast(Subscriptions.SubscriptionID as varchar(500)) + ''';' + '--- '+ [catalog].name + CHAR(13)  FROM ReportSchedule   INNER JOIN Schedule ON ReportSchedule.ScheduleID = Schedule.ScheduleID   INNER JOIN Subscriptions ON ReportSchedule.SubscriptionID = Subscriptions.SubscriptionID   INNER JOIN [Catalog] ON ReportSchedule.ReportID = [Catalog].ItemID   AND Subscriptions.Report_OID = [Catalog].ItemID  WHERE Subscriptions.DeliveryExtension = 'Report Server Email'  -- show only failed  --and LEFT (subscriptions.LastStatus, 12) != 'Mail sent to'  --and convert(varchar(20),Subscriptions.lastruntime, 101) = convert(varchar(20),getdate(), 101)...

31 Days of Extended Events by Jonathan Kehayias

https://www.sqlskills.com/blogs/jonathan/an-xevent-a-day-31-days-of-extended-events/  

Time-Sensitive Testing and Debugging

Add default parameter @OVERRIDE_NOW SMALLDATETIME = NULL. Specify a value when testing to set the current time; e.g. DECLARE   @TODAY DATE = GETDATE() , @NOW SMALLDATETIME; -- By default set @NOW to the current date and time. Specify a value for -- @OVERRIDE_NOW for testing purposes to show/hide the buckets. SET @NOW = IIF(@OVERRIDE_NOW IS NULL, GETDATE(), @OVERRIDE_NOW); -- setup the datetime values for our report buckets DECLARE  @STATS_10AM SMALLDATETIME = CONVERT(DATETIME, CONCAT(@STATS_DATE, ' 10:00')) , @STATS_1PM SMALLDATETIME = CONVERT(DATETIME, CONCAT(@STATS_DATE, ' 13:00')) , @STATS_4PM SMALLDATETIME = CONVERT(DATETIME, CONCAT(@STATS_DATE, ' 16:00')); -- Set the current time for each branch based on their time zone and the EST SELECT [BranchNumber] , [Time_Zone] , CASE WHEN [Time_Zone] = N'Central' THEN DATEADD(hour, -1, @NOW) WHEN [Time_Zone] = N'Mountain' THEN D...

How To Configure Database Mail

https://m60freeman.blogspot.com/2011/11/configure-database-mail.html  

sp_whoisactive by Adam Machanic

http://whoisactive.com/  

Performance Tuning Tools

https://www.davidklee.net/2020/11/11/pass-summit-2020-precon-scripts-and-links/  

Count the Number of Weekend Days between Two Dates

https://www.sqlservercentral.com/articles/count-the-number-of-weekend-days-between-two-dates  

Block User Objects from being Created in masrer

  https://www.sqlservercentral.com/articles/block-user-objects-from-being-created-in-a-master-database

Paul White Blog - sql kiwi

  https://www.sql.kiwi/

SQL Server Database Projects in Azure Data Studio

https://docs.microsoft.com/en-us/sql/azure-data-studio/extensions/sql-database-project-extension  

Transaction Log T-SQL

- Get the size of the TLOG files and how much space is used DBCC SQLPERF(logspace) DBCC LOGINFO DBCC OPENTRAN