When working with dates/times it can sometimes get a bit confusing when abbreviation options are introduced e.g. abbreviations may pad 0’s,use 24hr (HH) vs 12hr (hh) etc.
This post is simply a confirmation that abbreviations in datediff and datepart do return the same value.
DECLARE @starts datetime = '2017-06-12 19:00:05'
, @ends datetime = '2017-06-12 19:00:07';
SELECT DATEDIFF(ss,@starts,@ends) AS diff_ss
, DATEDIFF(s,@starts,@ends) AS diff_s
, DATEPART(ss,@starts) AS part_ss
, DATEPART(s,@starts) AS part_s;
If you’ve attempted to start the SQL Agent from the command prompt you likely would have received the following message:
It is possible to run the Agent, you just require arguments i.e.
- -c which allows you to use the command prompt, so always required
- -v optional verbose mode which includes the standard SQL Server Agent error log entries
- -iinstancename if you are using a named instance
Below shows with -c used for a default instance
Yes there will probably be times when you’ll need to use the above to troubleshoot Agent issues.
CTRL + C will stop the Agent.
You may have noticed that SSMS 17.1 now offers an upgrade package for existing SSMS 17.0 installs.
So what’s the difference? Roughly 400MB.
If for some reason you need to restore the system databases, you’ll typically find copies of the original system databases in the …\Binn\Templates folder.
Below shows the file on a SQL Server 2016 default instance installation:
Details on how to make use of them is found here
The Pause option on the SQL Server service account prevents new connections, but allows existing connections to continue operating.
When would you use this? Most likely during a patching or outage cycle to allow existing users to gracefully exit while preventing new connections.
The shutdown /i command has come in handy many a time and especially when you find that a server just doesn’t appear to be restarting and you’re unable to connect to it.
So if you find yourself in that situation, give this a try and see if it help to resolve the issue.
In case you missed it, AUTOGROW_ALL_FILES was added in SQL Server 2016 and tempdb has this enabled by default.
Further info is mentioned here.
EXEC sp_MSforeachdb '
DB_NAME() AS database_name
,CASE WHEN is_autogrow_all_files = 0 THEN ''no'' ELSE ''yes''
END AS is_autogrow_all_files
What this means is that you should be extra careful that you don’t run out of disk space when suddenly all files need to grow.
From SQL Server 2017 CTP 1.3 Cluster-less Availability Groups support was added.
So while you see the below in SQL Server 2016
You now see the option available in SQL Server 2017