Author |
Topic |
X002548
Not Just a Number
15586 Posts |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-10-26 : 09:41:39
|
dynamic sql, different database, table has been recreated with a different id (though it caught that now though), referenced via a view (don't know if it picks that up).Have a look at sp_depends and see why it's missing.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2011-10-26 : 09:50:09
|
quote: Originally posted by nigelrivett dynamic sql (None, heaven forbid), different database (Nope), table has been recreated with a different id (though it caught that now though)(Nope, dbo.), referenced via a view (don't know if it picks that up)(Nope).Have a look at sp_depends and see why it's missing.(Not yet)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspxhttp://weblogs.sqlteam.com/brettk/http://brettkaiser.blogspot.com/ |
 |
|
X002548
Not Just a Number
15586 Posts |
|
Sachin.Nand
2937 Posts |
|
X002548
Not Just a Number
15586 Posts |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-10-26 : 12:57:32
|
quote: Originally posted by X002548 [quote]Originally posted by nigelrivett table has been recreated with a different id (though it caught that now though)(Nope, dbo.)
Different ID, not different schema. So table dropped & recreated, or created after the procedure.sp_depends (in fact the entire pre-2008 dependencies) had more holes than swiss cheese--Gail ShawSQL Server MVP |
 |
|
X002548
Not Just a Number
15586 Posts |
|
X002548
Not Just a Number
15586 Posts |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-10-26 : 15:03:32
|
quote: Originally posted by X002548 ...and that was the AnswerThanks GailI thought that would have forced a recompile on a drop and create
Sure a drop/create forces recompiles of plans. Plans and recompiles however have zip, zero, nothing to do with dependencies though.--Gail ShawSQL Server MVP |
 |
|
X002548
Not Just a Number
15586 Posts |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-10-26 : 15:34:18
|
quote: Originally posted by X002548 ...of plans....not the sproc itself???
Semantics. A procedure has a plan. A recompile recreates part or all of a plan.quote: How can you get a new plan if the sproc isn't recompiled
Plan gets aged out of cache. Plan becomes invalid for one of several reasons (though that's called a recompile). SQL restarts. Something clears the plan cache (restore/detach/drop/offline a DB, reconfigure). There's a few more things too.None of these have anything to do with dependencies though.--Gail ShawSQL Server MVP |
 |
|
X002548
Not Just a Number
15586 Posts |
|
Kristen
Test
22859 Posts |
Posted - 2011-10-27 : 13:38:53
|
"When I manually recompiled the sprocs"You mean DROP / CREATE (or re-create using ALTER perhaps ...) ?orEXEC sp_recompile 'MySproc' ? |
 |
|
X002548
Not Just a Number
15586 Posts |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-10-27 : 15:16:02
|
quote: Originally posted by X002548 I did (and always do) Drop and Createsp_recompile I guess would have worked as well
No it wouldn't. All sp_recompile does is mark the procedure's plan for recompile, nothing more.Drop/create fixed sp_depends because the create set up the dependencies.quote: Never liked ALTER..what if it's stored a bad plan..as I've seen happen..
Altering a procedure removes its plan from cache. Has to, because the new procedure could have some completely different code in it.--Gail ShawSQL Server MVP |
 |
|
X002548
Not Just a Number
15586 Posts |
|
Kristen
Test
22859 Posts |
Posted - 2011-10-28 : 05:32:04
|
We've moved to using ALTER (with a CREATE of a dummy shell sproc first IF NOT EXISTS).Reason is that when we have to issue a fix on a production system it either runs, or leaves the original in place, and there seems to be less (not entirely sure there is NO) disruption to users.Our CREATE has:DROP PROCEDURE ...CREATE PROCEDURE ...GRANT EXECUTE ...so I suppose there was a window of opportunity between the two for users to find the sproc, but not to have permissions. And presumably plenty of window of opportunity to find no sproc! between the DROP and the CREATE.But for a scheduled rollout during downtime its probably a moot point. (Although DROP/CREATE will leave the sproc missing if there is an error during create, whereas ALTER will leave the original in place which might not be spotted). Perhaps I should add a test for Update Date after all rollout scripts have been done ... |
 |
|
X002548
Not Just a Number
15586 Posts |
|
Kristen
Test
22859 Posts |
Posted - 2011-10-28 : 11:02:29
|
"Can you trap a sproc compile failure???"Using a CREATE then it won't EXIST if there is a syntax error / failure.Not sure how I could be confident to have the "right version"" of Old Source. Maybe:IF EXISTS MyTempSproc drop MyTempSprocRENAME MySproc to MyTempSproccreate MySprocIF NOT EXISTS MySproc THEN RENAME MyTempSproc to MySproc |
 |
|
Kristen
Test
22859 Posts |
Posted - 2011-10-28 : 11:03:23
|
I suppose I could do something similar to insert a row into an ErrorLoggingTable and display that at the end of the script to alert me to things that had failed. Might make me complacent checking the output from the Rollout Script ... or might save me from myself on a bad day! |
 |
|
Next Page
|