Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi, In my application i want to set@fromdate = previous week Monday i.e., 3rd August and@todate = previous week saturday i.e., 8th August If the week changes, then @fromdate and @todate also need to be changedaccordingly.plz give some idea....
Here the solution,It will provide the previous week monday as Fromdate and Saturday as Todate.declare @date datetimeset @date =getdate()select @fromdate= @date-(7 +(DATEPART(weekday, @date) -2)) select @todate= @date-(7 -(7-DATEPART(weekday, @date)))select @fromdate,@todateSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/