Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

Abolish Disjointed Time

This editorial was originally published on Mar 8, 2018. It is being republished as Steve is out of the office.

One of the more complex types of data to deal with is date data. We have dates, times, strange rules for when mathematical operations occur, and when they don't. We have a period, which can be some combination of these, and that can include math rules that must be programmed consistently. Add to the issue of time zones where 3:00 isn't 3:00 everywhere in the world, especially those strange half and quarter time offset zones, and it's much more complex than seems necessary. There are no shortage of questions and articles at SQLServerCentral because this is a complex topic.

I read recently that the European Parliment is considering getting rid of DST. Quite a few of the members think the practice isn't useful and in a 384 to 153 vote, they decided to review whether or not they think this is a practice that should continue. There have been studies that show the change doesn't help with power, and it's certainly disruptive to everyone. I know it seems a percentage of people are always confused and either arrive early or late every year (or twice a year) when the clocks change. I know I've been late to work in the past on a Sunday when the clocks changed.

I'm of the opinion that we should do away with DST. I get a double whammy every year the I work for a company in the UK and the US changes clocks at a different time. That means I get meetings that move for a few weeks, and just as I adjust to the new time, they move back. It's a pain, and I'd just as soon do without it. There are also the adjustments to body clocks that likely slow our work and study habits, or at least mine, for a period of time. I'd just prefer that we stick to a single time schedule the entire year.

From a data perspective, the adjustments can cause issues with reporting and tracking data. Having an hour essentially repeat itself can distort any aggregation over that time period. Likewise losing an hour, especially if we use left joins to ensure each time period has a value, can look funny. I know the data issues aren't likely a big deal, after all, how much data does your company gather in the middle of Saturday night a couple times a year? Most reports probably don't bother to account for the discrepancies, and there don't seem to have been any issues I've seen from organizations. It's annoying to me as a data person, but it's probably not a significant issue.

Ultimately I think DST is just a little silly in this modern world, where specific times, especially daylight time, seems to be less of an issue. I work when I need to, take time off when I can, and it seems more and more companies do the same thing. Whether I go to work in the light or dark, the days are shorter in the winter.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
SQLServerCentral Article

Building a Database Dashboard with SSRS

Nisarg Upadhyay from SQLServerCentral

Learn how to create a dynamic database dashboard that tracks key metrics using SQL Server Reporting Services. From setting up to deploying your report.

External Article

Power BI Data Gateway to Connect Data Sources in the Cloud and On-Premises

Additional Articles from MSSQLTips.com

In this article, learn how to set up and use Microsoft Data Gateway to connect data sources from various locations such as cloud or on-premises.

External Article

Six Things to Monitor with PostgreSQL

Additional Articles from Redgate

This article describes six performance metrics that ought to be central to your PostgreSQL monitoring strategy. By using a tool like SQL Monitor to track these metrics over time, and establish baselines for them, you'll be able to spot resource pressure or performance issues immediately, quickly diagnose the cause, and prevent them becoming problems that affect users.

Blog Post

From the SQL Server Central Blogs - Efficient calculation of an ISBN-13 check digit

sqlrunner from SQLRunner

I thought I might pass along, what I have found to be, the most efficient way to validate the check digit within Azure SQL Server. I was looking to...

Blog Post

From the SQL Server Central Blogs - SQL Server on VMware Accelerator now free!

kleegeek from Technobabble by Klee from @kleegeek

My SQL Server on VMware Accelerator boot camp video series is now live on Youtube! There’s no strings attached and no price of entry, so now there’s no reason...

Azure SQL Revealed

Azure SQL Revealed: A Guide to the Cloud for SQL Server

Site Owners from SQLServerCentral

Access detailed content and examples on Azure SQL, a set of cloud services that allows for SQL Server to be deployed in the cloud. This book teaches the fundamentals of deployment, configuration, security, performance, and availability of Azure SQL from the perspective of these same tasks and capabilities in SQL Server. This distinct approach makes this book an ideal learning platform for readers familiar with SQL Server on-premises who want to migrate their skills toward providing cloud solutions to an enterprise market that is increasingly cloud-focused.

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Refreshing a View

Which of these can I use to refresh the metadata for a view?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Carlo Romagnano)

More OUTER APPLY

What does the last query?

declare @t table(i int) 
insert into @t
SELECT * FROM (VALUES
('1')
,('2')
,('3')
,(NULL)
) AS V([i])


SELECT t.i
      ,MSG.msg
  FROM @t t
OUTER APPLY
(
    SELECT msg = CASE t.i
                    WHEN 1 THEN 'ONE'
                    WHEN 2 THEN 'TWO'
                    WHEN 3 THEN 'THREE'
                    ELSE CAST(1/0 AS VARCHAR(10))
                 END
) MSG

Answer: Zero or some rows returned and the command breaks with 'Divide by zero error encountered.'.

Explanation: The first row with an invalid value raise an error: 'Divide by zero error encountered.' and no more rows are returned. The preceding rows with "good" value are returned. APPLY is a useful clause to run a subquery with changing parameters.  I use it in 3rd party views to check and invalidate data. Ref: APPLY - https://learn.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-ver16

Discuss this question and answer on the forums

 

 

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2017 - Administration
Log Shipping Jobs stop working automatically - Dear Friends, On my Log Shipping configuration , sometimes , more frequently actually, the Backup,Copy and Restore Jobs stop working automatically.. I have to check on them and run manually...and some times the restore has errors which force me to reconfigure it again..Any comments / advises on this will be highly helpful..Thank you.
Trace Flag 3444 - I just discovered trace flag 3444 set on a SQL 2017 srver, and I can't find reference to it. Has anyone come across this trace flag and what is it used for? Thanks MC
SQL Server 2016 - Administration
Vulnerability for ODBC driver 13 - ODBC driver 13 has been highlighted as having a vulnerability, and we have been advised to upgrade this to the latest version on our database server running SQL Server 2016 (SP3-GDR). There is apparently no recent version available for version 13. We already have ODBC driver 17.10.4.1 and ODBC driver 18.2.2.1 installed, so we duly […]
SQL Server 2016 - Development and T-SQL
T-SQL to run if in Active Directory Group - So we have a block of code that I only want system account to run.. but if a user is db_owner.. they still need access to run the full proc.. is there a way to check to see if the user is in the correct Active Directory group.. then I can set a flag that […]
WITH RECURSIVE gives error - WITH RECURSIVE factorial(F,n) AS ( SELECT 1 F, 3 n UNION ALL SELECT F*n F, n-1 n from factorial where n>1 ) SELECT F from factorial where n=1   Error Msg 102, Level 15, State 1, Line 26 Incorrect syntax near 'factorial'. Completion time: 2023-07-07T14:16:59.5379702-04:00 If i remove RECURSIVE option it works fine.
SQL Server 2019 - Administration
SSRS Theme Reset In SQL Server standard - We applied a theme to SSRS before a license key was applied. A theme which is not suitable has been set, and unfortuately a standard license key has been applied so i can no longer change the theme. Is am aware that as part of SQL Server Standard you can not set a theme, but […]
[SSIS Server Maintenance Job] failed - Executed as user: ##MS_SSISServerCleanupJobLogin##. The SELECT permission was denied on the object 'availability_databases_cluster', database 'mssqlsystemresource', schema 'sys'. [SQLSTATE 42000] (Error 229). any help with this will be appreciated!
SQL Server 2019 - Development
List Month End Dates Between Two Dates - Hi everyone I am working on a query where I need to list all business month end dates between two dates.  The two dates would define the start and end periods but these two dates are dynamically created: DECLARE @START_DATE DATE = DATEADD(YEAR,-1,GETDATE()) DECLARE @END_DATE DATE = GETDATE() I am not sure how to generate […]
SQL Azure - Administration
Azure SQL VM Patch installation though Automation account , update management - Hi All, Is it possible to apply SQL cummulatative update and OS CU at time by include the KB details in update management.
Integration Services
deploy ssis package to MSDB db in SSIS server using azure pipeline - Has anyone tried deploying ssis to MSDB db in SSIS server using Azure pipeline?  I am used to do the file system deployment using Azure pipeline but not to MSDB db. Din't find any good article on this on the internet.
Design Ideas and Questions
Thoughts on Database Per Service - Lately we've been asked to create several small databases.  These seemed related.  When we discussed this with the application developers they sent a link (https://microservices.io/patterns/data/database-per-service.html) that talks about individual services having their own database.  The article also talks about schema per service, which is what we are advocating, though there isn't much to be found […]
Anything that is NOT about SQL!
Need recommendations on replacing a NAS device for home use. - In my home office (SQL Server DBA, now a 13-year retiree) I have two NAS devices, a D-Link DNS-343 (4x2TB) and a WD EX4100 (4x10TB). I had to take the WD NAS off my surge protectors due to repeated 'power supply failure' notices, and it has worked since with no problem. My Win 10 machine […]
Administration
Transaction log BU fails in Maintenance Plan fails when there is no Full BU - I have 3 maintenance plans for full backups, differential and transaction log. The job for log backups fails in when there is no full backup. Which is logical of course. But is there a way to prevent this error from happening? I would like an option that it will not try to backup the log […]
SQL Server 2022 - Administration
RAISERROR Serverity 16 Showing in SQL Agent Log - We are evaluating SQL Server 2022 and have upgraded an SQL Server Fail Over Cluster and AG with with CU 4. In order not to run the jobs created by Reporting services on the passive node, we have added a step to check to all SQL Agent Jobs that does a RAISERROR to exit out […]
SQL Server 2022 - Development
SQL Server AOAG Add 3 IP's to LIstener with Powershell Script Not working - Team, Why does the below not work? Using parameters for listener name and ip addresses. When i hard code the IP addresses in there it works even with the listener as a parameter . I assume it has to do with the quotes. Any assistance is greatly appreciated. See full section of code not including […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -