Anyone know why sometimes osql just says ">1" and sqlcmd just outputs nothing and when I run the same select statement in Studio I get all the information I am looking for.Here is the select statement I am using and the commands I am using:SELECT command, s.text, start_time, percent_complete, CAST(((DATEDIFF(s,start_time,GetDate()))/3600) as varchar) + ' hour(s), ' + CAST((DATEDIFF(s,start_time,GetDate())%3600)/60 as varchar) + 'min, ' + CAST((DATEDIFF(s,start_time,GetDate())%60) as varchar) + ' sec' as running_time, CAST((estimated_completion_time/3600000) as varchar) + ' hour(s), ' + CAST((estimated_completion_time %3600000)/60000 as varchar) + 'min, ' + CAST((estimated_completion_time %60000)/1000 as varchar) + ' sec' as est_time_to_go, dateadd(second,estimated_completion_time/1000, getdate()) as est_completion_timeFROM sys.dm_exec_requests rCROSS APPLY sys.dm_exec_sql_text(r.sql_handle) sWHERE r.command in ('RESTORE DATABASE', 'BACKUP DATABASE', 'RESTORE LOG', 'BACKUP LOG')
>osql -E -Sneosql -dmaster -i\\dwsql2005\c$\hta\sql\GetTimeEstimate.sql -o c:\timeestimate.log>sqlcmd -E -Sneosql -dmaster -i\\dwsql2005\c$\hta\sql\GetTimeEstimate.sql -o c:\timeestimate.log