如何在一年的SQL Server中计算没有日期的星期天 [英] how to calculate no of sundays with date in a year sql server

查看:109
本文介绍了如何在一年的SQL Server中计算没有日期的星期天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我必须在sql server中计算日期中一年中没有星期日的时间.


谢谢你
mohd wasif

Hi,

I have to calculate no of Sunday in a year with date in sql server.


thanking you
mohd wasif

推荐答案

如何在sql中使用datename().您可以将日期与文本表示形式进行比较,并在条件中使用简单的加法.
How about use of datename() in sql. You can compare the date with the text representation, and use simple addition in condition.


看看这一点,它应该对您有所帮助: ^ ]

Have a look at this, it should help you out: Similar discussion.[^]

This is an UDF example on similar lines that can be modified.[^]


这篇关于如何在一年的SQL Server中计算没有日期的星期天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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