SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Update Help..


Update Help..

Author
Message
rocky_498
rocky_498
SSC-Addicted
SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)SSC-Addicted (430 reputation)

Group: General Forum Members
Points: 430 Visits: 1371
Hi Guys,

Need favor.
Here is the e.g. I am using TABLEA.ID (as an e.g) in my SP.I am not sure how many SP I am using TABLEA.ID. What i want to update TABLEA.ID TO TABLEB.ID from ALL SPs in my database.

Please let me know if my question is not clear. Any help would be great help.

Thank You.
Kingston Dhasian
Kingston Dhasian
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3687 Visits: 5177
You can use the below mentioned query to find all un-encrypted routines using "TABLEA.ID"

SELECT   OBJECT_NAME(object_id) AS RoutineName
FROM sys.sql_modules AS sm
WHERE sm.definition LIKE '%TABLEA.ID%'



You can then manually changes all the SP's
I would suggest you to do some documentation of the procedures involved and make the changes carefully even if it takes a lot of time.


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Jason-299789
Jason-299789
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2073 Visits: 3232
Unfortunately there is no magic wand to do this, so its a pain staking trawl through all SP's, as people may have used Aliases, etc.

You might be able to get an Idea of the scale by using the



Select * from sys.syscomments
WHERE [TEXT] Like '%TABLEA.ID%'




But for long SP's you may need to link these together using the Id and colId references.


Select distinct
SCHEMA_NAME(schema_id) AS [Schema_name]
, Objects.name Object_Name
from sys.syscomments
INNER JOIN sys.objects on objects.object_id=syscomments.id



You could reverse engineer the database into an SQL server Project if you have VS2008 GDR or VS2010 Premium (I think).

_________________________________________________________________________
SSC Guide to Posting and Best Practices
ScottPletcher
ScottPletcher
SSCertifiable
SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)

Group: General Forum Members
Points: 7837 Visits: 7145
Also, be sure to check: sys.sql_expression_dependencies.

And not just in its own db but in other dbs, esp. on the same instance.

And the usual disclaimer: even that isn't guaranteed to be every reference, of course. But it's probably the best list of references to that column you can get.

SQL DBA,SQL Server MVP(07, 08, 09)[size=2]Prosecutor James Blackburn, in closing argument in the Fatal Vision murders trial: If in the future, you should cry a tear, cry one for them [the murder victims]. If in the future, you should say a prayer, say one for them. And if in the future, you should light a candle, light one for them.[/size]
umarrizwan
umarrizwan
SSC Rookie
SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)

Group: General Forum Members
Points: 40 Visits: 49
SELECT obj.Name SPName, sc.TEXT SPText
FROM sys.syscomments sc
INNER JOIN sys.objects obj ON sc.Id = obj.OBJECT_ID
WHERE sc.TEXT LIKE '%' + 'Name Your Column Here' + '%'
AND TYPE = 'P'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search