sql server - SQL - Get Numerical Day of Month/Quarter -


Use of SQL Server 2005:

How can I get the number of days and days of the month Quarterly in a query?

  DECLARE @DATE DATETIME SET @DATE = GETDATE () SELECT DATEPART (dy, @DATE) AS DayOfYear -, & lt; Something & gt; AS Def Quarter -, & lt; Some & gt; thank you in advanced!   

text ">

  DECLARE @DATE DATETIME SET @DATE = GETDATE () Select DATEPART (dy, @DATE) AS DayOfYear, DATEDIFF (d, DATEADD (qq, DATEDIFF (qq, 0, dd), 0) , @DATE) + 1 AS DayOfQtarter, Day (@date) AS DayoffMonth, DATEPART (dw, @DATE) AS DeFoyewick    

Comments