filmov
tv
MS SQL tutorial on CONVERT and CAST functions
Показать описание
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:
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
Complimentary videos:
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