Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 transac - if command

Author  Topic 

naushi
Starting Member

10 Posts

Posted - 2009-02-10 : 11:28:56
Pl look at code below - my scheduled job works fine and executes all of step 1 commands (processess txt files)and exists properly when success.run is there. but when the file SUCCESS.RUn is not there it keeps executing and nothing happens. the message 'SUNCCESS.RUN does not exist' does not diaplay either in autoload.out file. it never exits the prog and stays in 'executing' status. In my steps I arranged for prog to make 8 attempts every 30 minutes. However program keeps executing and nohting happens when SUCCESS.RUN is not there.

if exist F:\SQL_2005_Apps\az99nt9999\costTest\appFiles\success.run goto step1
echo SUCCESS.RUN does NOT exist!!!! >F:\SQL_2005_Apps\az99nt9999\costTest\packages\log\AUTOLOAD.out
goto step2

:step1
…code to process txt files ……

delete txt files del success.run file
:step2
del F:\SQL_2005_Apps\az99nt9999\costTest\appFiles\*.txt
exit
any help will be appreicated

naushi hussain

nr
SQLTeam MVY

12543 Posts

Posted - 2009-02-10 : 13:18:14
is it the echo command that's causing the problem? It's trying to ecreate the file so maybe the file exists and is locked? You don't have permissions on it, wrong folder...
What happens if you run the command in isolation?


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -