sqlserver 每30分自动生成一次
2013-05-07 14:53:03 来源:开发学院核心提示: DECLARE @BeginTime AS DATETIMEDECLARE @EndTime AS DATETIMEDECLARE @Hour AS INTDECLARE @Min AS INTSET @Min = DATEPART(Minute, GETDATE())IF @Min < 30BEGINSET
DECLARE @BeginTime AS DATETIME
DECLARE @EndTime AS DATETIME
DECLARE @Hour AS INT
DECLARE @Min AS INT
SET @Min = DATEPART(Minute, GETDATE())
IF @Min < 30
BEGIN
SET @BeginTime = CONVERT(VARCHAR(10), GETDATE(), 120) + ' ' + CAST(DATEPART(Hour, GETDATE()) AS VARCHAR) + ':30'
SET @EndTime = CONVERT(VARCHAR(10), GETDATE(), 120) + ' ' + CAST(DATEPART(Hour, GETDATE()) AS VARCHAR) + ':00'
SET @BeginTime = DATEADD(Hour, -1, @BeginTime)
END
ELSE
BEGIN
SET @BeginTime = CONVERT(VARCHAR(10), GETDATE(), 120) + ' ' + CAST(DATEPART(Hour, GETDATE()) AS VARCHAR) + ':00'
SET @EndTime = CONVERT(VARCHAR(10), GETDATE(), 120) + ' ' + CAST(DATEPART(Hour, GETDATE()) AS VARCHAR) + ':30'
END
EXEC up_GenReport @BeginTime, @EndTime
- ››一次性修改Windows7文件类型的关联
- ››sqlserver 每30分自动生成一次
- ››sqlserver安装和简单的使用
- ››SqlServer触发器、存储过程和函数
- ››SQLServer建立交叉表查询
- ››SqlServer强制断开数据库连接的方法
- ››SQLServer 2005 海量数据解决方案
- ››SQLServer 2008数据库查看死锁、堵塞的SQL语句
- ››SqlServer 插入多条数据
- ››SQLServer 2008 R2导出的SQL文件中没有数据
- ››SQLSERVER通过游标查询两个数据表共有字段名组合成...
- ››sqlserver2008实现拼音首字母和随机n位数的生成
更多精彩
赞助商链接