[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。
相关文档:
--1加内存表
EXEC sp_tableoption '表名','pintable', 'true'
--2卸载内存表
EXEC sp_tableoption '表名','pintable', 'false'
--2查询是否有内存表驻留
SELECT * from INFORMATION_SCHEMA.Tables
WHERE TABLE_TYPE = 'BASE TABLE'
AND OBJECTPROP ......
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 ......
GRANT
Name
GRANT -- 定义访问权限
Synopsis GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER }
[,...] | ALL [ PRIVILEGES ] }
ON [ TABLE ] tablename [, ...]
TO { username | GROUP groupname | PUBLIC } [, ...] [ WI ......
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. ......