Blog Of Sem: SQL SERVER TAKVIM TURKCE

SQL SERVER TAKVIM TURKCE



  ALTER VIEW BM_TAKVIM AS
WITH Calender AS (
    SELECT CAST('2019-01-01' AS DATETIME) AS dt
    UNION ALL
    SELECT dt + 1 FROM Calender
    WHERE dt + 1 <=  CAST('2019-12-31' AS DATETIME)
)
SELECT
dt


,CASE
WHEN DATENAME (Month,dt)='January' THEN 'Ocak'
WHEN DATENAME (Month,dt)='February' THEN 'Şubat'
WHEN DATENAME (Month,dt)='March' THEN 'Mart'
WHEN DATENAME (Month,dt)='April' THEN 'Nisan'
WHEN DATENAME (Month,dt)='May' THEN 'Mayıs'
WHEN DATENAME (Month,dt)='June' THEN 'Haziran'
WHEN DATENAME (Month,dt)='July' THEN 'Temmuz'
WHEN DATENAME (Month,dt)='August' THEN 'Ağustos'
WHEN DATENAME (Month,dt)='September' THEN 'Eylül'
WHEN DATENAME (Month,dt)='October' THEN 'Ekim'
WHEN DATENAME (Month,dt)='November' THEN 'Kasım'
WHEN DATENAME (Month,dt)='December' THEN 'Aralık' ELSE '' END Ay
,CASE WHEN DATENAME (Weekday,dt)='Monday' THEN 'Pazartesi'
WHEN DATENAME (Weekday,dt)='Tuesday' THEN 'Salı'
WHEN DATENAME (Weekday,dt)='Wednesday' THEN 'Çarşamba'
WHEN DATENAME (Weekday,dt)='Thursday' THEN 'Perşembe'
WHEN DATENAME (Weekday,dt)='Friday' THEN 'Cuma'
WHEN DATENAME (Weekday,dt)='Saturday' THEN 'Cumartesi'
WHEN DATENAME (Weekday,dt)='Sunday' THEN 'Pazar' ELSE '' END Gün
,Hafta = DATEPART(WEEK, dt)  FROM Calender

 GO

  SELECT *
 FROM BM_TAKVIM WITH(NOLOCK)
 Option(MaxRecursion 0)