Results 1 to 13 of 13
  1. #1
    Join Date
    Mar 2004
    Posts
    139

    Unanswered: simple stored procedure question

    If I put 5 or 6 stored procedures within another stored procedure will they be executed sequentially or all at once? Is there any method. I can manage this process with some code I was just wondering how query analyzer or an sp would handle this by default.

    create dbo.storedprocedure as update_data

    exec sp_1

    exec sp_2

    exec sp_3

    etc.
    Thanks,
    Bill

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040

    -- This is all just a Figment of my Imagination --

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    They are executed sequentially.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by tomh53

    What has that got to do with the price of tea in china

    The sprocs will run synchronously, each one waiting for the one before to finish

    If you want them to run asynchronously, create a job per sproc, and change the driver sproc to start the jobs
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by Brett Kaiser
    The sprocs will run synchronously, each one waiting for the one before to finish
    I don't think you mean that.... http://dictionary.reference.com/browse/synchronously
    The sprocs will run asynchronously, or as I said, sequentially.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Nov 2002
    Posts
    272
    Quote Originally Posted by blindman
    The sprocs will run asynchronously, or as I said, sequentially.
    No, Brett got it right.
    When working asynchronously, each process gets their own thread and stuff happens simultaneously.
    Synchronously, all processes share the same thread and therefore can not run simultaneously. One process needs to end before the next one can start.

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I was worried for a moment there....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I guess it depends on whether we are speaking English or Techie.....
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  9. #9
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I disagree with your interpretation

    http://www.thefreedictionary.com/synchronous

    if you put in the context of a thread,then it makes sense
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  10. #10
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    seems to be some confusion on what sync and async mean.

    In programming, an async method generally launches a separate thread to do a long-running task and then returns immediately. a sync method does the work on the thread that called it, so it doesn't return until the work is done.

    there is no way to spawn threads from a proc (unless it's a CLR proc) so all procs are synchronous in this sense.

  11. #11
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by jezemine
    there is no way to spawn threads from a proc (unless it's a CLR proc) so all procs are synchronous in this sense.
    Got money to back that up?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  12. #12
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    ok, none that I know of. please educate me.

  13. #13
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    So Brett, care to let us know how you do multithreading in t-sql?

    or were you referring just to calling msdb.dbo.sp_start_job?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •