[SQL Server]延迟执行
WAITFOR
指定触发语句块、存储过程或事务执行的时间、时间间隔或事件。
语法
WAITFOR { DELAY 'time' | TIME
'time' }
参数
DELAY
指示 Microsoft® SQL Server™ 一直等到指定的时间过去,最长可达 24 小时。
'time'
要等待的时间。可以按 datetime 数据可接受的格式指定
time,也可以用局部变量指定此参数。不能指定日期。因此,在 datetime 值中不允许有日期部分。
TIME
指示 SQL Server 等待到指定时间。
注释
执行 WAITFOR 语句后,在到达指定的时间之前或指定的事件出现之前,将无法使用与 SQL Server 的连接。
若要查看活动的进程和正在等待的进程,请使用 sp_who。
相关文档:
Subquery: (single-row subqueries and multi-rows subqueries).
select select_list
from table
where expr operator (select select_list from table);
single-row subqueries operator: =, >, >=, <, <=, <>
e.g.:
1. select department_id, min(salary) from employees group by department_id ......
Confirming granted privileges
Data Dictionary View Description
ROLE_SYS_PRIVS System privileges granted to roles
ROLE_TAB_PRIVS & ......
Differring Constraints:
Constraints can have the following attributes: DEFFERRABLE / NOT DEFFERRABLE, INITIALLY DEFFERRED / INITIALLY IMMEDIATE.
e.g.:
alter table dept2 add constraint dept2_id_pk primary key (department_id) deferrable initially deferred; // deferring constraint on creation. ......