熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> MySQL >> 正文

sqlserver 每30分自動生成一次

2022-06-13   來源: MySQL 

  DECLARE @BeginTime AS DATETIME

  DECLARE @EndTime AS DATETIME

  DECLARE @Hour AS INT

  DECLARE @Min AS INT

  SET @Min = DATEPART(Minute GETDATE())

  IF @Min <

  BEGIN

  SET @BeginTime = CONVERT(VARCHAR() GETDATE() ) + + CAST(DATEPART(Hour GETDATE()) AS VARCHAR) + :

  SET @EndTime = CONVERT(VARCHAR() GETDATE() ) + + CAST(DATEPART(Hour GETDATE()) AS VARCHAR) + :

  SET @BeginTime = DATEADD(Hour @BeginTime)

  END

  ELSE

  BEGIN

  SET @BeginTime = CONVERT(VARCHAR() GETDATE() ) + + CAST(DATEPART(Hour GETDATE()) AS VARCHAR) + :

  SET @EndTime = CONVERT(VARCHAR() GETDATE() ) + + CAST(DATEPART(Hour GETDATE()) AS VARCHAR) + :

  END

  EXEC up_GenReport @BeginTime @EndTime


From:http://tw.wingwit.com/Article/program/MySQL/201311/29548.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.