[英]How to update whole range of date with another range
I have a table name shiftsDates which have following column 我有一个表名称shiftsDates,其中具有以下列
**ShiftDateID** **ShiftID** **ShiftDate** **IsNonShiftDate**
1 20 3/2/2012 false
2 20 3/3/2012 false
3 20 3/4/2012 true
I want to update ShiftDate and IsNonShiftDate column if user select another shift date range for shift '20'. 如果用户为班次'20'选择另一个班次日期范围,我想更新ShiftDate和IsNonShiftDate列。 From UI I have only ShiftID value.
从用户界面我只有ShiftID值。 kindly give any hint how i accomplish this task.
请给我任何提示如何完成这项任务。 thanks
谢谢
I don't know if I understand the question 100% :) But I give it a try. 我不知道我是否100%理解了这个问题:)但是我尝试一下。 You have aa ShiftDateId e..g 2. and want to update all 3 rows.
您有一个ShiftDateId,例如2.,并想更新所有3行。
UPDATE YourTable
SET ShiftDate = <YourDate>
, IsNonSiftDate = <true|false>
WHERE ShiftId = (SELECT ShiftId FROM YourTable WHERE ShiftDateId = <<ourId>)
But try to answer give me more questions? 但是尝试回答给我更多问题吗? - Column InNonShiftDate is related to work days, so you have to find out WeekDay() of the Date?
-InNonShiftDate列与工作日有关,因此您必须找出Date的WeekDay()吗? - If you get a range (start / end ) then you want to insert a row for each day in that range?
-如果您获得一个范围(开始/结束),那么您想为该范围的每一天插入一行吗? This would be a stored procedure with a CURSOR then...
这将是一个带有CURSOR的存储过程,然后...
So I guess give us more Infos about your environment to give you a better answer. 因此,我想向我们提供有关您的环境的更多信息,以便为您提供更好的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.