In this video, we will be retrieving only part of a date or time from a datetime.
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
----
If you want to retrieve the Day, Month or Year from a date field, then you can use the DAY, MONTH and YEAR functions. However, there isn't an HOUR function.
Instead, you can use the DATENAME and DATEPART functions to do the same thing. DATENAME retrieves a string, such as 'April', whereas DATEPART retrieves an int, such as 4. Using these functions, you can then get any element of a date.
However, there are some quirks that you should know, especially when you are getting the WEEK from a date. You can specify which is the first day of a week by using SET DATEFIRST.
Смотрите видео Extract parts of dates - using DATENAME, DATEPART, DAY, MONTH and YEAR functions in SQL Server онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал SQL Server 101 09 Июнь 2021. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 11,220 раз и оно понравилось 87 посетителям.