SQL comparison of dates does not work -
this code not work:
conn.execute("create procedure mysuperprocedure begin if getdate() >= dateadd(hour," & waithours & ", dateadd(minutes," & waitminutes & ",'" & & "') begin blah blah... end end")
a sql agent job runs procedure every few seconds. shall not "blah blah..." part until time, every time because if statement returns true.
what possibly wrong? makes no sense @ all... :'(
not clear try achieve quick shows 2 syntax errors: ist minute not minutes , missing closing parenthesis in dateadd
some questions come mind:
- do try create stored procedure every time job executes?
- why not set job execute time want run instead of checking every second if time has come running job? :)
- why dynamic sql?
Comments
Post a Comment