如何在sql
中的两个日期之间找到星期六和星期日我试过
选择DATEDIFF(WW,'2014-05-08 12:49:56.000','2014-05-10 17:07:30.000')
但周六没有采取行动。请帮帮我
答案 0 :(得分:0)
试试这个,
alter procedure p_Ex
(@FDate datetime,@Tdate datetime)
as
begin
select x.Day from
(
select DATENAME(DW, CAST(CAST('u r Column Name'AS VARCHAR(10)) AS DATE)) AS [Day] from YourTableName
)X
Where X.Day='Sunday' OR X.Day='Saturday'
end;
exec p_Ex'2014-05-08 12:49:56.000','2014-05-10 17:07:30.000'