Get first Sunday of next month using T-SQL

后端 未结 9 2225
梦毁少年i
梦毁少年i 2021-02-09 13:19

Looking for a way to get the date in the format \"11/1/2009\", which would be the first sunday of next month. I want to run this query after the first sunday in october to get

9条回答
  •  野性不改
    2021-02-09 13:50

    Just an FYI rather then coming up with some code to do this how about using a calendar table.

    Take a look at this: http://web.archive.org/web/20070611150639/http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html

    This also may help: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=99696

提交回复
热议问题