Implicit and explicit data conversions

Keyboard Shortcuts

In order to perform mathematical operations or comparisons between two or more values in an SQL Server database, the data types of those values must match. When they don’t, a conversion needs to take place.

- [Instructor] In order to perform mathematical operations…or comparisons between two or more…values in a SQL Server database,…the data types of those values must match.…When the data types are different,…they will go through a process called datatype conversion.…Datatypes can be converted…either implicitly or explicitly.…Implicit conversions are automatic…and invisible to the end user.…SQL Server will take it on itself to elevate datatypes…to a common variation that will not result in data loss.…Let's take a look at this…by creating a new database called Data Conversions,…and then we're going to go through a series of exercises…where we declare some variables at specific datatypes,…and then process them through some calculations.…

This first one, we're going to create…a variable called varSmallint,…and we'll set it to the smallint datatype,…and we'll create another one called varInt,…and set that to the integer datatype.…Then we'll set the values…of varSmallint to five, and varInt to 50,000.…Now, what I want to do is add these two values together.…

Resume Transcript Auto-Scroll

Author

Released

12/19/2016

SQL Server is Microsoft's de facto relational database software. While you can build a simple database relatively easily straight out of the box, most administrators need to know how to take advantage of more advanced features in the latest release, SQL Server 2016, to give their clients everything they've come to expect in an enterprise database. In this course, Adam Wilbert shows experienced SQL Server DBAs how to develop a SQL Server 2016 database. Learn how to create data tables, including temporary tables and tables with variables, and schemas. Find out how to enforce data integrity with constraints and secure your database at the user level. Then discover how to create indexes to optimize performance, work with functions, and make sure your SQL database is as fast and secure as possible.