SQLUSA

Microsoft SQL Server 2000

Best Practices

 

How to set system date for reports?

 

The following stored procedure illustrates how to reset the system date in a reporting system to today's date:

create proc ResetShippingReportDate
as
begin
declare @CurrentDate char(10), @SystemDate char(10)
select @SystemDate=convert(char(10),[date],101) from ShippingReportDate
select @CurrentDate=convert(char(10),getdate(),101

if @CurrentDate <> @SystemDate
begin
update ShippingReportDate set [date]= getdate()
return 1
end
else
return 0
end

 

The World Leader in SQL Server Training
 
SQLUSA.com Home Page