Transaction - sql
t -sql
变量语法
declare @变量名 变量类型
go 批处理 语句的结束
SELECT 不能同时作为查询和赋值语句
使用select赋值,可以通过将多个查询结果分别赋值给不同的变量
cast(表达式 as 目标类型)
游标
游标移动到下一行
fetch next from 游标名 into 变量名
close coursorl关闭游标
deallocate coursorl销毁游标
exists
print exists(查询表)
5.select 列
1.from 表或子查询
2.where 条件
3.group by 分组
4.having 分组筛选
6.order by 排序
表连接:内连接,外连接(左外连接,右外连接,自然连接)
char varchar ncar nvarchar
类型名(长度)
var(10);“1”8
n:Unicode字符,一个字符占两个字节,非unicode一个英文字符占一个字节,汉字字符
占两个字节 byte
Create 创建对象
Alter table 修改对象
Drop table 删除对象
Identity 标识 ,种子
增加表 insert into
修改表update 。。set。。=’。。’where。。=‘。。‘
删除表 delete from 表名 where 。。!=“”