T-SQL 语法参考手册
十六、数据库用户.................................................................................................................................412
1、创建登录帐户...............................................................................................................................412
(1)添加 Windows 登录帐户............................................................................................................412
(2)添加 SQL 登录帐户.....................................................................................................................412
2、创建数据库用户...........................................................................................................................412
3、给用户分配权限...........................................................................................................................412
4、系统内置的数据库用户................................................................................................................412
(1)dbo 用户.....................................................................................................................................412
(2)guest 用户...................................................................................................................................412
十七、控制结构.....................................................................................................................................412
1、变量...............................................................................................................................................412
(1)局部变量.....................................................................................................................................412
(2)全局变量.....................................................................................................................................412
(3)WHILE 循环语句.........................................................................................................................413
(4)CASE—END 多分支语句.............................................................................................................413
(5)GO 批处理语句...........................................................................................................................413
十八、高级查询.....................................................................................................................................413
1、简单的子查询...............................................................................................................................413
(1)子查询的一般用法................................................................................................................413
(2)子查询替换表连接................................................................................................................413
2、IN(NOT IN)子查询....................................................................................................................413
3、EXISTS 子查询................................................................................................................................413
十九、事务.............................................................................................................................................413
1、使用 T-SQL 语句来管理事务.........................................................................................................413
2、判断某条语句执行是否出错........................................................................................................414
3、事务必须具备 ACID 四个属性......................................................................................................414
4、事务的分类...................................................................................................................................414
5、事务例句.......................................................................................................................................414
6、事务隔离级别...............................................................................................................................414
11