如何在 SQL 中为 CURRENT

编程入门 行业动态 更新时间:2024-10-21 19:36:39
本文介绍了如何在 SQL 中为 CURRENT_TIMESTAMP 添加月份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何向 SQL Server 中的 CURRENT_TIMESTAMP 添加月份?

How can I add months to the CURRENT_TIMESTAMP in SQL Server?

解决方案可能在于 DATEADD() 但这仅适用于日期,而不适用于日期时间.

The solution probably lies in DATEADD() but this works with a date only, not a datetime.

谢谢.

推荐答案

这很好用

SELECT DATEADD(month,1,CURRENT_TIMESTAMP)

来自 DATEADD (Transact-SQL)

日期

是一个表达式,可以解析为时间、日期、smalldatetime、datetime、datetime2 或日期时间偏移值.

Is an expression that can be resolved to a time, date, smalldatetime, datetime, datetime2, or datetimeoffset value.

更多推荐

如何在 SQL 中为 CURRENT

本文发布于:2023-10-24 19:51:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524844.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中为   如何在   SQL   CURRENT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!