question

Gangadhar.marisetti avatar image
Gangadhar.marisetti asked

Plz explain the following query?

select 1,12.0 union all select 1.0,getdate() what is the result and how it comes like that explain
sqlserver
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Squirrel avatar image
Squirrel answered
---- ------------------------------------------------------ 1.0 1900-01-13 00:00:00.000 1.0 2014-03-26 13:24:39.037 (2 row(s) affected) Data Type Precedence http://technet.microsoft.com/en-us/library/ms190309.aspx Datetime is higher than decimal, so the 12.0 is converted to datetime data type. Which is 12 days from 1900-01-01
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.