The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

OK, it's a feature, not a bug, but successfully converting between a TIMESTAMP and an INTEGER is [cough] unexpected, especially when the TIMESTAMP becomes a DATE.

So... where can I read about this behavior, and what else I should watch out for?

SET @y = @x;
SELECT @@VERSION, @x, @y, ISDATE ( @x );

'',20120727,'2012-07-27 00:00:00.000',1

asked 27 Jul '12, 11:47

Breck%20Carter's gravatar image

Breck Carter
accept rate: 21%

edited 27 Jul '12, 11:50

This is covered in Ivan's whitepaper on mixed-type comparisons, which can be found on my blog.

permanent link

answered 30 Jul '12, 08:48

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%

Comment Text Removed
Comment Text Removed

This is the closest thing I can find readily:

"Exact numeric values of type SMALLINT, INTEGER, BIGINT, and NUMERIC can be converted to date values. The conversion is performed by treating the number as a string. For example, the integer value 20100401 represents the first day of April in 2010."

permanent link

answered 27 Jul '12, 22:04

John%20Smirnios's gravatar image

John Smirnios
accept rate: 40%

Comment Text Removed
Comment Text Removed
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 27 Jul '12, 11:47

question was seen: 726 times

last updated: 30 Jul '12, 10:14