SQL Server & Tibco Spotfire Ideas & Samples
SQL, TSQL, Tibco Spotfire...
Nov 9, 2009
find last 30th working date.
declare @i int
set @i =1
Declare @dt smalldatetime
Set @dt=GETDATE()
While @i<=30
Begin
IF (datepart(dw,@dt) Between 2 and 6)
BEGIN
SET @i = @i + 1
END
SET @dt = @dt - 1
End
select @dt
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)