In this video we will learn, converting one data type to another using cast() and convert() functions. We will also learn how to use the style parameter, with convert() function. Finally we will look at a practical example of using CAST or CONVERT functions, along with group by. We will also talk about the differences between CAST and CONVERT functions and when to choose one over the other.
Text version of the video
Slides
All SQL Server Text Articles
All SQL Server Slides
All Dot Net and SQL Server Tutorials in English
All Dot Net and SQL Server Tutorials in Arabic
Nguồn: https://rumanoffsfinejewelry.com/
Xem thêm bài viết khác: https://rumanoffsfinejewelry.com/tong-hop/
Xem thêm Bài Viết:
- Thuê chung cư Phú Thạnh quận Tân Phú: Lựa chọn an toàn cho mùa dịch
- Giới thiệu tổng quan dự án khu đô thị La Phù – Hoài Đức
- Hướng dẫn khắc phục lỗi "Đang chờ tải xuống" trên cửa hàng Google Play Store
- Dragon Ball Tập 137 – Đám Cưới Của Songoku – Phim Bảy Viên Ngọc Rồng
- 7 Loài Cá Cảnh Nước Ngọt Dễ Nuôi Và Phù Hợp Với Bể Cá Nhỏ | Cá Cảnh | Coi Là Ghiền
Thank you, this was helpful !
How to convert one date format into another, Ex to_date(column name, 'yyyy-mm-dd') , Column _nam format is yyyymmdd.
Thank you Kudvenkat, amazing videos on SQL. DO you have similar video's for SSAS and SSIS
Thank you very much for the explanation. I'm always following your videos to learn and find the solution related to SQL question. In one of my sql query result, I'm getting the error Conversion failed when converting the nvarchar value '““““`'to data type int. However, due to number of columns and tables in my query, I'm not able to find the exact value which cautioning the issue. Can please explain how can we find such values with multiple join tables and many columns. Thank you.
HI where can i get the DB you are working on.
Venkat Can we use Rollup query as GroupBy Rollup(Registration Date as Date)
It could be also convert
Convert (char(13),tablenameofdateofbirth,104)
how to convert mm to ft in
Hello sir, same as u explained in video i tried. But, getting the same values in nvarchar also.
i have two column id and nane id 1 name salmankhan i want to split name like fname= salman and lname =khan into seprate column
sir make video on performance of query ans SSIS
HI BRO IF I EXECUTE THIS
SELECT CAST('1993.06.19' AS nvarchar)
IT IS STILL LIKE "1993.06.19"
I AM USING SQL 2012
BUT IN YOUR EXAMPLE IT WOULD BE LIKE JUNE 6 1993
HOW DO I SOLVE THIS PROBLEM?
Thank you bro
Hi sir
When I am converting Date to integer or decimal using cast and convert, it's reflecting the date value less than its actual value.
Please suggest.
create procedure st_getShifts
as
select s.sh_id as 'ID',
s.sh_name as 'Name',
format(s.sh_fromTime,'hh:mm tt') as'From',
format(s.sh_toTime,'hh:mm tt') as'TO',
s.sh_number as 'Number'
from shifts s
error show WHEN EXUCUTE
Msg 195, Level 15, State 10, Procedure st_getShifts, Line 49
'format' is not a recognized built-in function name.
HOW SOLVE PLS HELP ME
Very detailed…and very nice explanation
Thank you!
perfect. Thanks a lot
how can i convert a video into a data in sql?
It is very help ful video for the Learners but in the in version 2014 it does not work and I try with following Syntax and it works.
SELECT ID, Name, DateOfBirth, CONVERT(VARCHAR(15), DateOfBirth,9) AS ConvertedDate FROM Employees
Result:
1 Sam 1980-12-30 Dec 30 1980
2 Pam 1982-09-01 Sep 1 1982
3 John 1985-08-22 Aug 22 1985
4 Sara 1979-11-29 Nov 29 1979
My date is stored in the varchar and I want to convert it to date type so that i can extract month and date from it. please help
please help
Hello sir, how to solve this problem —–>The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
I would a bit modify the title: "Best SQL Server tutorial ever – Part 28"
Love You Kudvenkat
4:43 => The important difference between Convert and Cast
You speak clearly.So easy to understand the concepts!
Thanks.
that was amazing , you really solved my problems. thanks a lot
Write a query which returns the total number of registrations by Year?
select cast(datepart(year,doj)as int)as 'DOJ',count(id) from tblDate
group by cast(datepart(year,doj) as int)
Thanx! That's great ! It is very useful! You are great SQL teacher!
this videos are very helpful for beginners. definitely ill suggest my friends…
thank you so much
This was very good…thank you! I need to learn the difference between nvar and var
can anyone help how do we convert YYYYMMDD (int) to MM/DD/YYYY(datetime) ?
This is the best SQL tutorials I have come across. I got trained from best of the professor from US based university but they are not as detailed as you in explanation.,,,,Kudos Mr.Venkat
In 2005 SQL server how I to retrieve 'date' only from 'date time, data type
Awsome, I am now watching ur each video step by step….. This is really helpful for me… Thanks for ur video.
Very clear explanation!
Sir My Cast and Convert function is not working..Can You please help me..Both functions is written same value which is inside Dateofbirth table..EG : = 1991-11-15 00:00:00.000 in Dateofbirth..& When i convert this it's showing Again 1991-11-15 00:00:00.000 in ConvertedDBO..Please Help me sir..
I had made a table with column of data type datetime2 but neither CAST() nor Convert() worked with that column but when i changed it to datatype of datatime it worked ,, so is it just not working with datetime2 datatype ??
sir kindly help with tutorial 27.plz tell me a simple way of calculating age it is very complicated.
Hi Venkat! what's the datatype for DateofBirth you used while creating tblemployees?
Revisit since I like it
Thanks
Venkat, thank you VERY much for providing all of this material free of charge. For those of us who are hands on type of learners, is the database(s) for these tutorials available to download?
Hi Venkat…..Thanks a lot for these tutorials….I noticed that CAST and CONVERT does not work for Datatype DATETIME2…is it correct?
requsting to upload linq C# tutorials