想要比较当前日期与SQL Server 2008中的财政年度 [英] want to compare present date with financial year in sql server 2008

查看:100
本文介绍了想要比较当前日期与SQL Server 2008中的财政年度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个带有日期列的表,我想将其与
比较
当前财政年度




i have a table with a column of date , i want to compare it with

present financial year

推荐答案

每个国家都有自己的财政年度.根据您的需要,可以使用CONVERT& GETDATE获取当年的月份和年份.基于此,您可以将当前日期与一个财政年度进行比较.

参考:
MSDN:CAST和CONVERT(Transact-SQL) [ SQL SERVER –检索–从DateTime中选择仅日期部分–最佳做法" [
Every country has their own financial year. Depending on what you want, you can use CONVERT & GETDATE to get the month and year of current year. Based on which you will get to compare the current date with a financial year.

Reference:
MSDN: CAST and CONVERT (Transact-SQL)[^]
SQL SERVER – Retrieve – Select Only Date Part From DateTime – Best Practice[^]


这篇关于想要比较当前日期与SQL Server 2008中的财政年度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆