April 24, 2008 at 7:55 am
can i arrange a hot coffee for you ?
karthik
April 24, 2008 at 8:50 pm
I've been out on a job. Sorry for throwing this out there and running, but I hoped it could get you started...
Jeff Moden (4/24/2008)
Barry, would you explain why you used WHERE N BETWEEN N AND somedateformula? I think it should have been WHERE N BETWEEN 1 AND somedateformula.
Thanks for picking this up Jeff, and you're right, of course. I'm pretty sure it was supposed to be "N BETWEEN 1 and ...".
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
April 25, 2008 at 12:25 am
rbarry,
Thanks for your prompt reply.
karthik
April 25, 2008 at 6:26 am
rbarryyoung (4/24/2008)
I've been out on a job. Sorry for throwing this out there and running, but I hoped it could get you started...Jeff Moden (4/24/2008)
Barry, would you explain why you used WHERE N BETWEEN N AND somedateformula? I think it should have been WHERE N BETWEEN 1 AND somedateformula.Thanks for picking this up Jeff, and you're right, of course. I'm pretty sure it was supposed to be "N BETWEEN 1 and ...".
Not a problem... knowing you, I thought you may have come up with some new bit of "rocket science" using the Tally table and was too busy to test for the same reason as you 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
April 25, 2008 at 2:55 pm
Jeff Moden (4/25/2008)
rbarryyoung (4/24/2008)
Not a problem... knowing you, I thought you may have come up with some new bit of "rocket science" using the Tally table and was too busy to test for the same reason as you 🙂
Sadly, not this time. But your confidence is flattering 🙂
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 28, 2008 at 8:53 pm
I didn't check your code, but here's what I noticed.
1. Someone mentioned "Firehose" cursor. That means Fast Forward and Read Only. Cursors, by default, are aware of changes in the table used for the SELECT. I didn't see that you were looking for changes explicitly.
2. I didn't see any select statement on the temp table within the cursor loop, so drop the index. It takes overhead to keep rebuilding it everytime you insert a record. Add it after you're done.
3. Do you really need the BEGIN/COMMIT TRANS? That alone is twice the work. Once to check for the error and then to actually insert it.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply