Giriş
Not: Bu sütun tipi yerine datetime2 kullanılması öneriliyor. datetime2 kesin milisaniye ve microsaniye saklayabiliyor
Açıklaması şöyle
The DATETIME data type specifies a date and time with fractional seconds.DATETIME supports dates from January 1, 1753, through December 31, 9999.The default value is 1900-01-01 00:00:00. The time is based on 24-hour clock.
Format şöyle
yyyy-MM-dd HH:mm:ss[.nnn]
nnn 0 to 999 arasında bir sayı olabilir. Yani milisaniyeyi temsil eder. Ancak milisaniye kısmı aslında yuvarlanır. Açıklaması şöyle
datetime rounds fractional seconds to the nearest 0, 3, or 7 milliseconds.
Örnek
DATETIME tipini DATE tipine çevirmek için şöyle yaparız
SELECT * FROM table1 a INNER JOIN table2 b ON a.id = b.a_id AND CONVERT(date, a.dt) = CONVERT(date, b.dt)
No comments:
Post a Comment