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
 Other SQL Server Topics (2005)
 Batch.bat file call Stored Proc, no SQL activity

Author  Topic 

ixcrazee
Starting Member

1 Post

Posted - 2009-12-03 : 05:17:54
I have a batch file (*.bat) that it contains an osql statement to execute a stored proc in the database, by passing in parameters. I found out in one of the customer server, that the SQL job can trigger this batch file successfully and the activity monitor shows that the process is active and running, but when I traced with SQL Profiler, I found NO SQL activity in my tracing. So far this only happen to one of the customer server.

NOTE: The stored proc is designed to be called concurrently by passing in different parameters. Therefore I can have 3 batch files calling the same store proc and passing different parameter in order to process different set of data. Two (2) of the processes can be completed without problem, but one of the process will stay and no SQL activity show in Profiler, as mentioned above.

I have attached the code snippet that shows the content of Batch1.bat and Batch2.bat. Any idea what could possibly caused this, or what I should further check on or look into? Your advice is very much appreciated! Thank you.

REM Batch1.bat: Process sequence 1 data
osql -Usa -Ppwd -Sserver -Q"EXEC database1.dbo.name_compare_sp 'sequence1','p2'" >> D:\Test\1.dat
********************************************************
REM Batch2.bat: Process sequence 2 data
osql -Usa -Ppwd -Sserver -Q"EXEC database1.dbo.name_compare_sp 'sequence2','p2'" >> D:\Test\2.dat

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-12-03 : 09:43:44
what events are you capturing and what filters are you using in profiler? are you capturing rpc starting/completed?

by the way, should use sqlcmd on sql2005
Go to Top of Page
   

- Advertisement -