Código SQL:
Ver originalCREATE TABLE #temp
(
semana INT,
mes INT
)
DECLARE @inicio datetime
DECLARE @x INT
DECLARE @YEAR INT
SET @x=1
SET @inicio='01/01/2013'
SET @YEAR=DATEPART(YYYY,@inicio)
while @x=1
BEGIN
INSERT INTO #temp
SELECT datepart(wk,@inicio) semana ,DATEPART(mm,@inicio) mes
SET @inicio=DATEADD(DD,7,@inicio)
IF DATEPART(yyyy,@inicio)<>@YEAR
SET @x=0
END
SELECT * FROM #temp
DELETE FROM #temp
saludos!