Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私のデータは以下のようなものです
2010-11-09 13:20:02.000
日付のみ取得したいです。どの SQL 関数を使用しますか?
私の好みは (その柔軟性のため) DATEADD/DATEDIFFです:
DATEADD
DATEDIFF
SELECT DATEADD(day,DATEDIFF(day,0,'2010-11-09T13:20:02.000'),0)
同じパターンを使用して他の丸め効果を実現できるため、柔軟性があります。たとえば、月の初日を取得するには、日ではなく月を dateadd/datediff できます。また、指定された日付の月末や、指定された日付から 3 か月後の月末などを検索するためにも使用できます。