【问题标题】:How to create condition for a field in SQL如何在 SQL 中为字段创建条件
【发布时间】:2012-09-16 08:14:51
【问题描述】:

如何限制在 SQL 中为字段输入的值

Appointment ( Appointment_ID, Appointment_Date, Appointment_Time )

我要限制输入的值应该是

Appointment_Date (Monday – Friday) 
Appointment_Time (08:00- 17:00)

【问题讨论】:

标签: sql date criteria conditional-statements restriction


【解决方案1】:

您可以为此使用检查约束。 从日期中提取日期并使用 between 子句检查时间。

你用的是什么数据库?

【讨论】:

  • 感谢@Marc B 真的很有帮助
  • 嗯,看来你已经解决了。尽管如果您在前端使用编码进行这些验证,效率会高得多。尽量减少对数据库服务器的压力。
猜你喜欢
  • 2011-10-11
  • 1970-01-01
  • 2012-04-11
  • 1970-01-01
  • 2016-07-27
  • 1970-01-01
  • 2019-12-31
  • 2019-02-15
  • 1970-01-01
相关资源
最近更新 更多