This is a follow up video to part 1. In this quick video you will see that SQL Server is better off with explicit conversion at it likes it. Implicit conversions are not a good thing for SQL Server. Your queries are silently suffering from performance issues and consuming extra CPU cycles while implicitly converting from one data type to another. For example, if you are trying to assign an INT to a VARCHAR variable, the INT value will automatically be converted to the VARCHAR type. When you are trying to assign a VARCHAR value to an INT type, the VARCHAR will get converted to an INT type if it is possible to do so. This means if the VARCHAR holds a numeric value, the conversion will work. And if it holds character data, SQL Server will throw an error. Therefore the resulting data type depends on the statement itself. For example, for comparison operators or other expressions, the resulting data type depends on the rules of data type precedence. Well, whatever the scenario be, the moot point is that there is a performance penalty that is paid when an implicit conversion happens as the engine has to determine the rules and take action. It is advisable you should use CAST or CONVERT function as appropriate and perform an explicit conversion. To Know more watch the video below.
Get new content directly in your inbox – Click here
You can also visit DataPlatformGeeks (DPG) Video Library to watch more videos and to download video resources (presentation & demo code).
Hope the video was worth your time.