Lavsa, Rich
Rich_Lavsa at pghcorning.com
Wed Jul 27 13:45:16 CDT 2005
Background: SQL 2000, have 2 procedures. Both run fine on their own. Next step is to execute them on a scheduled basis, however one needs to run and finish before the other starts. What I want to happen: First procedure simply deletes all records in a DataMart table. Second procedure runs an insert query that pulls data out of many tables in our ERP and denormalizes it into a single table structure for quick processing (37 minute query) Can I combine both procedures into one? If so how, when I tried this the second procedure disappeared. I had the Delete statement followed by GO, then the Insert statement followed by GO. It seemed to save it, but when I opened it back up it was gone (happened more then once). Would it be easier to look for changes and only apply the changes and new records, if so how would I go about doing this? I didn't think this would matter in my case as the table is strictly a reference table and the 37 minute query will take 37 minutes to run no matter what. Looking for some guidance as I am teaching myself all I can about MS SQL SERVER.. I have done some simple procedures that only do Selects, no cursors. Did some dynamic sql stuff but that's about as deep as I have gotten into Procedures so if anyone could help and excuse my ignorance I would greatly appreciate it. Thanks in advance, Rich