我如何使用sql2000检索datediff(mm/dd/yyyy)格式 [英] How do i retrive datediff(mm/dd/yyyy) format using sql2000
本文介绍了我如何使用sql2000检索datediff(mm/dd/yyyy)格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我该如何以完整格式检索同时显示日期,月份,年份的日期差异
how do i retrieve date diff with full format that show day,month,year at same time
推荐答案
给你.您需要一个过程.
http://stackoverflow.com/Questions/57599/how-to-calculate-age-in-t-sql-with-years-months-and-days [
This would be useful to you. You need a procedure.
http://stackoverflow.com/questions/57599/how-to-calculate-age-in-t-sql-with-years-months-and-days[^]
你不能.甚至Prerak建议的存储过程方法都具有致命的缺陷:没有SQL日期格式允许年份或月份为零.请参阅 MSDN [
You can''t. Even the stored procedure approach that Prerak recommends has a fatal flaw: there is no SQL date format that allows year or month zero. See MSDN[^]
I would strongly recommend that you instead return a number of days between the two dates
SELECT DATEDIFF(day, [date], GETDATE()) FROM myTable
,如果确实需要,则将其处理为一个日期.
and process that into a date if you really need it.
这篇关于我如何使用sql2000检索datediff(mm/dd/yyyy)格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文