Aan de slagGa gratis aan de slag

Implicit conversion between data types

This is what you need to remember about implicit conversion:

  • For comparing two values in SQL Server, they need to have the same data type.
  • If the data types are different, SQL Server implicitly converts one type to another, based on data type precedence.
  • The data type with the lower precedence is converted to the data type with the higher precedence.

In this exercise, you are going to test if explicit conversion works between a numeric type and a character. use information from the conversion table, where the implicit and explicit conversions between all data types are presented. You are going to try an implicit conversion between two different data types.

For this, you will use the voters table and will compare the total_votes numeric column with a character.

Deze oefening maakt deel uit van de cursus

Functions for Manipulating Data in SQL Server

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT 
	first_name,
	last_name,     
	total_votes
FROM voters
___
Code bewerken en uitvoeren