select DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE())-1, 0) --First day of previous month
select DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE())-1, -1) --Last Day of previous month
More Related Contents:
- Sql Server string to date conversion
- How to convert SQL Server’s timestamp column to datetime format
- How can I truncate a datetime in SQL Server?
- What is the significance of 1/1/1753 in SQL Server?
- How to get Time from DateTime format in SQL?
- How to remove the time portion of a datetime value (SQL Server)?
- SQL – The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
- Date conversion and culture: Difference between DATE and DATETIME
- SQL Query to find the last day of the month
- Handling date in SQL Server
- How can I get the sum of multiple datetime values?
- Comparing dates stored as varchar
- Add default value of datetime field in SQL Server to a timestamp
- Best way to store time (hh:mm) in a database
- Retrieving the date in SQL Server; CURRENT_TIMESTAMP vs GetDate()
- SQL Server Group by Count of DateTime Per Hour?
- Why SQL Server DATETIME type saves time in ticks of 1/300 of a sec?
- SQL Server: convert ((int)year,(int)month,(int)day) to Datetime [duplicate]
- Convert a string with ‘YYYYMMDDHHMMSS’ format to datetime
- Convert UTC Milliseconds to DATETIME in SQL server
- How does SQL Server decide format for implicit datetime conversion?
- Undesired rounding of DateTime in SQL Server
- How to convert text column to datetime in SQL
- How to calculate difference in hours (decimal) between two dates in SQL Server?
- Comma separated results in SQL
- Which are more performant, CTE or temporary tables?
- Defining a one-to-one relationship in SQL Server
- Can you call a webservice from TSQL code?
- How to safely use reserved SQL names?
- SSRS report definition is newer than Server