| A community of more than 1,600,000 database professionals and growing |
| | Fun with Dates and Times The other day I got a Github issue that asked if we here at SQLServerCentral should set our dates as YYYYMMDD in the new SQLServerCentral site. The issue noted that there were some inconsistent dates. Article dates are in a similar format, YYYY/MM/DD, but we do have some DD MMM YYYY and a few places where I think the American MMBBYYYY has lived on. In any case, I made a joke on Twitter of asking if people were alright moving to YYYYMMDD. Most people were in favor, though someone asked about MMMM DD, YYYY, which is easily read. I have to say that I somewhat like that for reading, but as data, as something I'd work with, I prefer having the year month day format. I do want separators, and while I grew up using slashes ( as in YYYY/MM/DD), I know the ISO format is dashes (YYYY-MM-DD). ISO 8601 has dashes, so I decided to add that to the GitHub issue as a way of formatting. What about using month names? As I look through various sites, I find inconsistencies. Some use dates, like Jan 11, 2019. Others might use 11 Jan 2019 or 2019-01-11. I find that MSDN uses regional settings, so the en-us version of a page will have 01/11/2019, but if I change to the en-Gb version, I see 11/01/2019. That seems find as a UI enhancement, but I hope that the actual value is stored as 2019-01-11. We don't need them time Or do we? There are times involved. While most of us might not care about whether something was published at 8am or 9am, we might care about where it was published and the time. Certainly 8am in Christchurch if far different from 8am in Honolulu. Do we store time zones? Or keep all dates in one? The logical thing is to keep dates in UTC and then adjust based on the client settings to display something that matches their time zone. We've been storing data in UTC, though the server time has been the Mountain time zone in the US for historical reasons. I don't like that dependency, so I'm sure we'll change that. Dates and times are both simple and not simple. There are decisions to be made, and far too many of us take them lightly. While the display is of secondary importance, it's likely that we'll often use this data in other systems, as a way of marking a change, or even as a way of ordering our data. Having consistent and known date time formats is important as a data professional. I hope you pay attention to how you gather and store this data. Steve Jones from SQLServerCentral.comJoin the debate, and respond to today's editorial on the forums |
| The Voice of the DBA Podcast Listen to the MP3 Audio ( 4.3MB) podcast or subscribe to the feed at iTunes and Libsyn. The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. | |
|
|
| ADVERTISEMENT | | Redgate University Self-paced online training courses with easy to follow classes on getting started, exploring advanced features, and making the most of Redgate products. Learn the fundamentals, best practices, and top tips from the experts - Redgate’s Microsoft Data Platform MVPs and engineers. Start Learning |
| | NEW SQL Provision: Create, protect, & manage SQL Server database copies for compliant DevOps With SQL Provisions virtual cloning technology, databases can be created in seconds using just 1MB of storage, and sensitive data can be anonymized or replaced with realistic data to ensure it is protected as it moves between environments. Download your free trial |
|
|
|
| | | David Durant from SQLServerCentral.com We've now seen how indexed and non-indexed tables perform in queries, and established "logical reads" as the metric for query performance. Now it is time to explain why logical reads are an excellent metric and also explain what is actually being read. More » |
| Press Release from Redgate Fundamentals of SQL Server 2012 Replication provides a hands-on introduction to SQL Server replication. The book introduces you to the technologies that make up replication, and then walks you through setting up different replication scenarios. When you've finished reading, you should be able to implement your own multi-server replication setup while following the principle of least privilege. More » |
| Additional Articles from MSSQLTips.com In this tip we look at T-SQL code that can be used to determine the greatest common divisor for a set of integers. More » |
| Jason Brimhall from SQLServerCentral Blogs It isn’t very often that one would consider a short circuit to be a desired outcome. In SQL Server we... More » |
| ChrisJenkins from SQLServerCentral Blogs My third data warehousing tip is to build thin slice. Deliver iterative releases. Get valuable feedback and buy in, and... More » |
|
|
| | Today's Question (by Steve Jones): I have a data set of statistics from the completed 2018 NFL season. The data set looks like: > head(nfl2018.qb) Rk Player Tm Age Pos G GS QBrec Cmpâ.. Att CompPrcnt Yds TD 1 1 Ben Roethlisberger\\RoetBe00 PIT 36 QB 16 16 9-6-1 452 675 67.0 5129 34 2 2 Andrew Luck\\LuckAn00 IND 29 QB 16 16 10-6-0 430 639 67.3 4593 39 3 3 Kirk Cousins\\CousKi00 MIN 30 QB 16 16 8-7-1 425 606 70.1 4298 30 4 4 Matt Ryan\\RyanMa00 ATL 33 QB 16 16 7-9-0 422 608 69.4 4924 35 5 5 Patrick Mahomes*\\MahoPa00 KAN 23 QB 16 16 12-4-0 383 580 66.0 5097 50 6 6 Derek Carr\\CarrDe02 OAK 27 QB 16 16 4-12-0 381 553 68.9 4049 19 TD. Int Int. Lng Y.A AY.A Y.C Y.G Rate QBR Sk Yds.1 NY.A ANY.A Sk. X4QC GWD 1 5.0 16 2.4 97 7.6 7.5 11.3 320.6 96.5 73.0 24 166 7.10 7.04 3.4 2 3 2 6.1 15 2.3 68 7.2 7.4 10.7 287.1 98.7 71.5 18 134 6.79 6.95 2.7 3 3 3 5.0 10 1.7 75 7.1 7.3 10.1 268.6 99.7 60.6 40 262 6.25 6.48 6.2 1 0 4 5.8 7 1.2 75 8.1 8.7 11.7 307.8 108.1 70.6 42 296 7.12 7.71 6.5 1 1 5 8.6 12 2.1 89 8.8 9.6 13.3 318.6 113.8 82.0 26 171 8.13 8.89 4.3 2 2 6 3.4 10 1.8 66 7.3 7.2 10.6 253.1 93.9 49.3 51 299 6.21 6.09 8.4 3 3 I want to get a list of the player names, teams, and attempts (Att) that have a CompPrcnt greater than or equal to 100. What command would help me here? |
Think you know the answer? Click here, and find out if you are right. We keep track of your score to give you bragging rights against your peers. This question is worth 1 point in this category: R Language. We'd love to give you credit for your own question and answer. To submit a QOTD, simply log in to the Contribution Center. |
|
|
| |
ADVERTISEMENT | Extract, Transform, and Load with SQL Server Integration Services: With Microsoft SQL Server, Oracle, and IBM DB2 Readers will learn by example how to use Microsoft SQL Server 2016 Integration Services (SSIS) as they design and implement extract, transform, and load (ETL) solutions to support a business application that integrates with a data warehouse and an online Web store across a heterogeneous system. This volume describes proven methods to support common ETL needs, such as databases communicating directly with each other, using files to exchange data, or performing database operations using Web services. Pick up your copy of this great book today at Amazon today. |
|
|
|
|
|
| Yesterday's Question of the Day |
| Yesterday's Question (by Steve Jones): I have a new SQL Server on Linux instance set up. I want to enable some trace flags on instance startup. What should I do? Answer: Use mssql-conf to configure these Explanation: The mssql-conf utility is designed to configure various settings for SQL Server on Linux. You can use this to set trace flags for instance startup. Ref: Trace flags with mssql-conf - click here » 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/ OS patching - Hi All, I am trying to gather some SQL server version and OS lvl information and thinking what is the best... Can NULLs Exist in the Columns of a Non-Clustered Index? - A fairly credible source (SolarWinds, DPA help function) had this advice for determining the causes of table scans: Investigate Non-Clustered Indexes... count by fiscal quarter - Hi, I am trying to get the count of data by fiscal quarters where Q1 starting from Feb. My below query... Session stuck in killed\roll back - One of the session that is executing a stored proc from an application is stuck in the killed\rollback phase. Arguably,... Import many databases - Hi, I have 100 databases, with 1000 table each database (all databases= 5 TB). What is the most simple method to import... Database refresh from Production DB to Test DB in Sql server 2014 - Hello, I would like to know the what's the best way i can do Database refresh from Production DB to Test DB... How do I insert into a table that only has a single (identity) column? - I have a table with only 1 column "fldID". That column is a primary key (to ensure uniqueness), identity column... cte Coding... Need the case statement to get this to work - Hello, I had a cte query that is working. We need to reset the date every August. So, the cte coding... Quetions about inserting data from two tables into one - HI, have two tables with similar column name but not totally the same. For example, on table have ABA the other... memory setting in sql server - from the GUI I changed the max memory setting clicked ok and restarted the SQL services, but it still does... Using Cross Apply with WHERE clause - I finally have an opportunity to use CROSS APPLY in my code, but I can't seem to get it to... Claculated field in Where clause - Hello, am looking for the best, or most efficient way to implement a store procedure where I have several calculated fields... Restored SSRS not working - hi folks we had a pretty bad attack on one of our sql servers which also runs ssrs 2005 the server was... Visual Studio C# project. Export DataTable to Excel formatting of column - Hi All, I am working on a C# project that pulls data from an SQL database, formats it in a DataGridView,... Run New PowerShell Process As A Different User - Hello, I'm trying to create a PowerShell script that will run a new PowerShell Process as a different 'Windows' user. The following code seems... Multiple data sets returned by proc - Hi, So I've a fun one to deal with. Picture this if you will; You have 5 tables, each with 10 columns... SSIS Foreach Container - Chopping part of a filepath off - Really confused today, and I've no idea why SSIS is doing this for any other reasons than to torment me. I... How to update SSAS 2008 dimension without redeploying whole cube? - Hi all, I have made some changes to the hierarchies in a single dimension within a SSAS 2008 project - sorry for... SQLDUMPER_ERRORLOG.log - Hi everybody, i'm getting one dump file when i run SSIS package. Any idea about how SQLDUMPER_ERRORLOG.log file is creating?... New SQL Saturday presentation ideas? - So, I'm thinking that I need to come up with a new SQL Saturday presentation, but I'm finding myself clamoring... |
|
| This email has been sent to newsletter@newslettercollector.com. 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. Feel free to forward this to any colleagues that you think might be interested. If you have received this email from a colleague, you can register to receive it here. | This transmission is ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. Contact: webmaster@sqlservercentral.com |
|
|