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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -