SQL Server Performance

oSQL results in bat file to variable

Discussion in 'General Developer Questions' started by MichaelB, Dec 6, 2007.

  1. MichaelB Member

    I am trying to run a osql query and put the results into a DOS variable. The query is only a select @@rowcount after a select into a temp. I want to send a postie if the DOS variable is > 0 . can this be done?
    I can currenly output to a text file and if the errorlevel is NOT -101 then I postie the results. I can do this using the exit(query) parameter. When I do I get :
    sql: Error converting exit value
    Either way would work for me. the way I am doing it - if I can get rid of the error OR by putting the results into a dos variable...any thoughts?
  2. satya Moderator

    Can you make use of Powershell in this case?

Share This Page