MS SQL tutorial on CONVERT and CAST functions

Published: 10 October 2021
on channel: Accessible IT Software Tutorials
2,599
24

This is a Microsoft SQL tutorial video demonstrating the use of the CONVERT and CAST functions. These functions change the data types of data, variables and columns.

Complimentary videos:
Data types:    • MS SQL covering an introduction to da...  

Complimentary SQL:
select '01 Jan 2021', convert(date, '01 Jan 2021')--, convert(date, '41 Jan 2021')
, convert(char(10), '01 Jan 2021', 103), convert(char(10), cast('01 Jan 2021' as date), 103)
, convert(char(10), cast('01 Jan 2021' as date), 3)
, convert(varchar(20), getdate(), 113)
, convert(char(10), getdate(), 103), convert(varchar, getdate(), 108)
, convert(char(10), getdate(), 103) + ' ' + convert(char(5), getdate(), 108)

select convert(varchar, cast(12345.6789 as money), 0)
, convert(varchar, cast(12345.6789 as money), 1)
, convert(varchar, cast(12345.6789 as money), 2)


select distinct pe.FirstName + ' ' + pe.LastName + ' ' + CAST(pv.AverageLeadTime AS VARCHAR(5)), CONVERT(char(10), pe.ModifiedDate, 103)
from Purchasing.ProductVendor pv
inner join Person.BusinessEntityContact be on pv.BusinessEntityID = be.BusinessEntityID
inner join Person.Person pe on be.PersonID = pe.BusinessEntityID


On this page of the site you can watch the video online MS SQL tutorial on CONVERT and CAST functions with a duration of hours minute second in good quality, which was uploaded by the user Accessible IT Software Tutorials 10 October 2021, share the link with friends and acquaintances, this video has already been watched 2,599 times on youtube and it was liked by 24 viewers. Enjoy your viewing!