November 21, 2023 at 3:20 pm
hi,
I call few stored procedure from a .bat file and .bat file is executed from micrisoft windows sheduler, need to know that , does it call in syncronious or asyncronious way?
i.e firstly it executes the stored procedure in first line and waits for the completion of the sp then it goes to second line for the second stored procedure?
yours sincerly
November 21, 2023 at 3:52 pm
synchronous
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 21, 2023 at 7:46 pm
I just want to add some clarity to Scott's reply - it depends. You CAN have your BAT file run synchronously OR asynchronously. It depends on the BAT file. For example, this is all sync:
foo.exe
bar.exe
Same with this:
START "foo" /WAIT foo.exe
START "bar" /WAIT bar.exe
BUT if you want it to run async, you would run it like this:
START "foo" foo.exe
START "bar" bar.exe
Source - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
November 22, 2023 at 4:45 am
this is how i am calling
xyz.bat this is called from microsoft sheduler. the contenct of .bat is followng.
sqlcmd -S abc -U rr -P xyz -Q "use db EXEC usppp @strSourcedb = N'dba',@strTargateDb = N'dbb'"
sqlcmd -S abc -U rr -P xyz -Q "use db EXEC usppp @strSourcedb = N'dba',@strTargateDb = N'dbb'"
so the question was is it syncronious that mean when i check activitymonitor i must not get two sessionid of database running same stored procedure's queries.
Q1)that is first call should execute first in a sessionid @spid then after the complition this spid should go away from my activity monitor then next call of the same stored procedure should execute in diffrent @spid. ( that is at one time i must see only one spid in my activity monitor executing a query of the above stored procedure)
Q2) can i see two spid of same (instence) stored procedure in above case with two diffrent quries of the same SP at the same time in activity monitor?
Q3) can i see same spid twoice, in activity monitor with diffrent/same query of the same stored procedure at the same time in activity monitor?
November 22, 2023 at 5:08 am
This was removed by the editor as SPAM
November 22, 2023 at 7:11 am
This was removed by the editor as SPAM
November 22, 2023 at 10:33 am
This was removed by the editor as SPAM
November 22, 2023 at 10:33 am
This was removed by the editor as SPAM
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply