on 2012 Jul 27 12:47 PM
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?
BEGIN DECLARE @x INTEGER; DECLARE @y TIMESTAMP; SET @x = CURRENT TIMESTAMP; SET @y = @x; SELECT @@VERSION, @x, @y, ISDATE ( @x ); END; @@VERSION,@x,@y,ISDATE(@x) '12.0.1.3298',20120727,'2012-07-27 00:00:00.000',1
This is covered in Ivan's whitepaper on mixed-type comparisons, which can be found on my blog.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the closest thing I can find readily: http://dcx.sybase.com/index.html#1201/en/dbreference/comparisons-date-wsqltype.html
"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."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.