如何在每个月的考勤系统中找到星期日(使用枢轴功能) [英] How to find sunday in every month in attendance system(using pivot function)

查看:103
本文介绍了如何在每个月的考勤系统中找到星期日(使用枢轴功能)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作每月基础格式的考勤系统。

1 2 3 S 5 6 7 ---月末

PPASPPP ---出勤状况



我想打印S(星期日)而不是4。

i want to make attendance system which is format on monthly base.
1 2 3 S 5 6 7 ---MONTH DATE
P P A S P P P --- ATTENDANCE STATUS

I want to print S(sunday) instead of 4 .

推荐答案

坚持修改后的版本这是你的功能。

SELECT CASE DATEPART(WEEKDAY,att.Attendance_Date)

WHEN 1

那么'

ELSE

DATEPART(DAY,GETDATE())

END AS Day_Name
Stick a modified version of this in your function.
SELECT CASE DATEPART(WEEKDAY,att.Attendance_Date)
WHEN 1
THEN 'S'
ELSE
DATEPART(DAY,GETDATE())
END AS Day_Name


感谢您的回复..



但我坚持在另一个地方



如何在sql server 2008 R2中使用pivot功能生成动态列。

表示我必须在1月份生成31列,在2月生成28或29列(按月数)。
Thanks for replying..

But i stuck at another place that is

how to generate dynamic column using pivot function in sql server 2008 R2.
means i have to generate 31 column for january month and 28 or 29 column for feburary month(as per days in months).


这篇关于如何在每个月的考勤系统中找到星期日(使用枢轴功能)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆