What I need is the SQL code to display the last business day - usually will be one day prior, but I want that if I run this code on Monday that, instead of Sunday's date, I get Friday's date.
This is what I started with
- Automatically generate last business day declare @LastBusinessDay varchar(8) set @LastBusinessDay = CONVERT(varchar(8), DATEADD(WEEKDAY,-1,GETDATE()), 112) select @LastBusinessDay
I guess I thought that the WEEKDAY parameter in the DATEADD would only show dates that are from Monday - Friday. How can I achieve this