Tuesday, April 24, 2007

New Transact SQL Video Tutorial: 02 - Implicit Datatype Conversion and How SQL Server Converts Data in Expressions

02 - Implicit Datatype Conversion and How SQL Server Converts Data in Expressions - view details
This video is all about how SQL Server can automatically (implicitly) convert datatypes in expressions. For example, in the expression 'SELECT 1 + 10000 + 0.00', what will the return datatype be? 1 could be a BIT, a TINYINT, a SMALLINT, an INT, or a BIGINT - which is it? 10000 could be a SMALLINT, INT or BIGINT. 0.00 could be a DECIMAL, NUMERIC, FLOAT, REAL, MONEY, or SMALLMONEY.

Highlights from this video:
  • In the expression, SELECT '123', is '123' a string or a number?
  • In the expression, SELECT 2007/08/08, is the return type an INT, a DECIMAL, or a DATETIME?
an much more on datatypes


So what is the answer to our question above? The answer is that if you just typed that expression in, your return type would be a FLOAT.


To download this video, log in, then visit the video's detail page and click "download". This is a subscriber-only video so a subscription is required.

Note: You must have the TSCC codec installed to view this video


Keywords Associated with this video: data type conversion, cast, convert, cast and convert, numeric, decimal, varchar(max), nvarchar(max), float, real, int32, int64

0 Comments:

Post a Comment

<< Home