The FORMAT function in SQL Server - extracting single or multiple parts of a datetime

Опубликовано: 16 Июнь 2021
на канале: SQL Server 101
8,098
82

In this video, we will be extracting parts of dates and times using the FORMAT function.
My SQL Server Udemy courses are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: https://rebrand.ly/querying-microsoft...
98-364: Database Fundamentals (Microsoft SQL Server): https://rebrand.ly/database-fundamentals
70-462 SQL Server Database Administration (DBA): https://rebrand.ly/sql-server-dba
Microsoft SQL Server Reporting Services (SSRS): https://rebrand.ly/sql-server-ssrs
SQL Server Integration Services (SSIS): https://rebrand.ly/sql-server-ssis
SQL Server Analysis Services (SSAS): https://rebrand.ly/sql-server-ssas-mdx
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): https://rebrand.ly/microsoft-powerpiv...
----
My Excel for PC courses are:
Beginner to Excel - https://rebrand.ly/microsoft-excel-sp...
Intermediate to Expert Advanced - https://rebrand.ly/microsoft-excel-ex...
Power Table, Get and Transform and Power Pivot - https://rebrand.ly/visualizing-data-e...
VBA macros for Excel - https://rebrand.ly/excel-vba-pc
----
The FORMAT function in SQL Server is fairly similar to the FORMAT function in Excel. However, there are a few differences.
Firstly, you can use .NET standard coding strings - see https://docs.microsoft.com/en-us/dotn... for more details.
Secondly, you can use custom date and time coding strings, which are more extensive than in Excel - see https://docs.microsoft.com/en-us/dotn...
Thirdly, in Excel you can use 'mm' for months, and 'hh' for hours between 0 and 23. However, in SQL Server you need to use 'MM' for months, and 'hh' for hours between 0 and 11, and 'HH' for hours between 0 and 23.


Смотрите видео The FORMAT function in SQL Server - extracting single or multiple parts of a datetime онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал SQL Server 101 16 Июнь 2021. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 8,098 раз и оно понравилось 82 посетителям.