From the course: Developing Microsoft SQL Server 2016 Databases

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Implicit and explicit data conversions

Implicit and explicit data conversions - SQL Server Tutorial

From the course: Developing Microsoft SQL Server 2016 Databases

Implicit and explicit data conversions

- [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.…

Contents