今天财务总监说老板想看这样的统计信息,每周的销售情况。
所以要写如题函数 :
-- =============================================
-- Author: <David Gong>
-- Create date: <2013-01-11>
-- Description: <查询指定日期所在年份第几周>
-- =============================================
ALTER Function [dbo].[WeekOfDate]
(
@Date DateTime --要转换的日期
)returns INT
as
begin
DECLARE @Year int