SqlServer系列笔记——其它
2016-11-13 01:31
211 查看
1、waitfor 命令是让程序停顿指定的时间在运行或在指定时间运行
waitfor delay '00:00:02' 延迟两秒运行
print (getdate())
waitfor time '12:00:00'到12点再运行
print '放学了'
2、go 批处理执行程序
不用go如果有错误整段代码都执行失败
用gogo之间的代码块独立执行 如果有一段失败提示有误 但是其它代码段依然被执行
批处理循环执行
go
print 'hello'
go 2
3、with
with a as (select * from student)
select * from a
4 goto 跳转到标签
goto error
print 'here'
error:
print 'imhere'
获取自动增长的主键值
insert into Person(age,Name) values(3,'abc'); select @@identity
insert into Person(age,Name) output inserted.id values(3,'abc')
waitfor delay '00:00:02' 延迟两秒运行
print (getdate())
waitfor time '12:00:00'到12点再运行
print '放学了'
2、go 批处理执行程序
不用go如果有错误整段代码都执行失败
用gogo之间的代码块独立执行 如果有一段失败提示有误 但是其它代码段依然被执行
批处理循环执行
go
print 'hello'
go 2
3、with
with a as (select * from student)
select * from a
4 goto 跳转到标签
goto error
print 'here'
error:
print 'imhere'
获取自动增长的主键值
insert into Person(age,Name) values(3,'abc'); select @@identity
insert into Person(age,Name) output inserted.id values(3,'abc')
相关文章推荐
- Opencv2系列学习笔记2(图像的其它操作)
- SqlServer系列笔记——数据类型
- SqlServer系列笔记——用户自定义函数
- SqlServer系列笔记——日期函数
- SqlServer系列笔记——case when 语句
- struts2系列学习笔记(7)---------------其它形式的结果处理
- SqlServer系列笔记——临时表
- SqlServer系列笔记——游标
- SqlServer系列笔记——索引
- SqlServer系列笔记——字符串函数
- SqlServer系列笔记—变量
- SqlServer系列笔记——简单查询
- SqlServer系列笔记——数据类型转换
- SqlServer系列笔记——事务(Transaction)
- SqlServer系列笔记——存储过程
- 《Cortex™-A系列编程者指南(V3.0)》第14章<其它异常处理>笔记
- SqlServer系列笔记——流程控制语句
- SqlServer系列笔记——联合查询UNIONSqlServer系列笔记
- SqlServer系列笔记——查询过滤分组排序
- SqlServer系列笔记——空值