|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Today @ 1:13 AM
Points: 1,720,
Visits: 746
|
|
Nice Question.
SELECT * FROM tempdb.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME LIKE '#TempQoD%'
Regards, Rals.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 3:36 AM
Points: 2,522,
Visits: 3,616
|
|
Edit: Items in bold
There seems to be some confusion around what is happening here (or I misread some of the comments and the QotD answer?). The data types of the columns are determined by the expressions in the SELECT statement only. The INTO clause has no impact other than creating the table based on the resulting data types of the SELECT clause.
datatype for '15 Jan 2013' is simple, but for completeness:
SELECT SQL_VARIANT_PROPERTY('15 Jan 2013', 'BaseType') ExpressionDataType
varchar
The inferred datatype for {d '2012-11-15'} is:
SELECT SQL_VARIANT_PROPERTY({d '2012-11-15'}, 'BaseType') ExpressionDataType
datetime
Best Regards,
Chris Büttner
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: 2 days ago @ 6:54 AM
Points: 9,364,
Visits: 6,462
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 2:35 PM
Points: 1,685,
Visits: 642
|
|
After having read Tom's explanation on why it ended up as DateTime. This at least made sense to me.
I would like to think that in the future Microsoft could put a bit more effort into this and actually recognise a Date or a Time data type and not keep making everything DateTime.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 2:55 AM
Points: 1,112,
Visits: 967
|
|
Nice learning. Thank you.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 7:28 AM
Points: 2,637,
Visits: 1,632
|
|
| It was tricky to me but i guessed right. Great point to note.
|
|
|
|