Actually, he wanted to run 2 queries simultaneously (asynchronously), originating from within the same stored procedure.
Unless row-by-row is the only way to go (and as Kirsty rightly points out, there's *nearly* always a more efficient way), this sounds like something that's begging for a set-based approach, especially when he says that the contract ids are retrieved from another table at run-time. My point, if you can select one from another table, you can select as many as apply.
P
-----Original Message-----
From: Mat.Elkington
[mailto:mssqldba-ezmlmshield-x24589033.[Email address protected]
Sent: Friday, October 29, 2004 11:11 AM
To: LazyDBA Discussion
Subject: SUSPECT: RE: parallel execution of query
Oh yeah don't get me wrong - I wouldn't advise the use of cursors under all circumstances by any means. I much prefer temporary tables and honest-to-god straightforward queries where possible.
Just struck me that in this instance that might fit the bill...
-----Original Message-----
From: Pollock Kirsty
[mailto:mssqldba-ezmlmshield-x56391755.[Email address protected]
Sent: 29 October 2004 16:03
To: LazyDBA Discussion
Subject: RE: parallel execution of query
As I understand it, Kanwar's problem is perfomance, so he wants to run
individual updates/inserts in parallel - each one takes a long time.
This is why several of us are urging a look at basic strategy, as this
is often where huge savings can be made.
I say this very carefully, but ... *most* cursor-based solutions are
slower than the equivalent set-based solutions and in some cases by very
large factors. It is very rare that a database programming task cannot
be solved using set-based operations - at least such has been my
experience, and I've had done my fair share of optimisation.
I'm NOT looking to get into an OT discussion on that topic, just
mentioning it, since performance seems to be the major issue with the
problem as stated.
> -----Original Message-----
> From: Mat.Elkington
> [mailto:mssqldba-ezmlmshield-x1006649.[Email address protected]
> Sent: 29 October 2004 15:08
> To: LazyDBA Discussion
> Subject: RE: parallel execution of query
>
>
> So again, why not use a cursor...?
>
> -----Original Message-----
> From: Pollock Kirsty
> [mailto:mssqldba-ezmlmshield-x76470629.[Email address protected]
> Sent: 29 October 2004 14:56
> To: LazyDBA Discussion
> Subject: RE: parallel execution of query
>
>
> I still don't see why that mandates doing one contract at a
> time as opposed to a set-based operation.
>
> > -----Original Message-----
> > From: Singh Kanwar
> > [mailto:mssqldba-ezmlmshield-x33555071.[Email address protected]
> > Sent: 29 October 2004 14:27
> > To: LazyDBA Discussion
> > Subject: RE: parallel execution of query
> >
> > i do not know all the contractIDs in the advance, it has to
> be picked
> > up from other table at the time of execution, because the
> contractids
> > keep changing. because of nature of work, DTS is not feasable.
> >
> > Thanks
> >
> > KP
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com To unsubscribe:
> http://www.lazydba.com/unsubscribe.html
> For additional commands, e-mail: mssqldba-[Email address protected]
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity
> to whom they are addressed. If you have received this email
> in error please notify the system manager.
> This footnote also confirms that this email message has been
> swept for the presence of computer viruses but this in no
> way indicates that the message is virus free.
> **********************************************************************
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com To unsubscribe:
> http://www.lazydba.com/unsubscribe.html
> For additional commands, e-mail: mssqldba-[Email address protected]
>
>
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]
MS Sql Server LazyDBA home page