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


Update Help..


Update Help..

Author
Message
rocky_498
rocky_498
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2708 Visits: 1476
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
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11452 Visits: 5331
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
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12449 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
SSC-Forever
SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)

Group: General Forum Members
Points: 46980 Visits: 8060
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) 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.
umarrizwan
umarrizwan
SSC-Enthusiastic
SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)

Group: General Forum Members
Points: 190 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