Just a day before I was presenting at Virtual Tech Days and I wanted to demonstrate the current time to the audience using SQL Server Management Studio, I ended up a quick error. If any of you ever tried to CONCAT function multiple values of different datatype this should not be surprising to you.
SELECT 'Current Time ' + GETDATE()
I quickly modified the script to the following workaround and my script worked right away.
SELECT 'Current Time ' + CAST(GETDATE() AS VARCHAR(20))
Current Time Dec 20, 2011, 7:00PM
However, I instantly realized that I can use SQL Server 2012 function which can right fit for this situation.
SELECT CONCAT('Current Time ', GETDATE())
I have previously written in detail article about SQL Server 2012 CONCAT function over here additionally, I have written a quick guide on 14 new functions of SQL Server Denali.
Watch a quick video relevant to this subject:
Here are a few links to the blog post which you can read for additional reading:
- SQL Server – 2016 – New Feature: Dynamic Data Masking
- SQL Server – 2016 – T-SQL Enhancement “Drop if Exists” clause
- SQL SERVER 2016 – Comparing Execution Plans
- SQL SERVER – 2016 – Opening JSON with OPENJSON().
- SQL SERVER 2016 – New T-SQL Functions – COMPRESS – DECOMPRESS
With every release of SQL Server, Microsoft has been adding enhancements to the product. Earlier I have written below blogs talking about new features/enhancements. Now I will write about features for SQL Server 2016 which are COMPRESS – DECOMPRESS.
Reference: Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)