November 26, 2009 at 1:21 am
Hi All,
I am new to adminstration. can you help me with following.....
My application contains 300 tables & 1000procedures. Now am adding additional column to some tables ( say 180 ). Now i need to change the SPs which referes these tables, to accept one extra parameter and the logic of the existing sps need to be changed to include the filter condition based on the new parameter.
Is there anyway that i can automate this or do I need to do it manually by selecting the dependencies of each tale one by one.
Thanks for you help....:)
November 26, 2009 at 6:19 am
PavanKK (11/26/2009)
Hi All,I am new to adminstration. can you help me with following.....
My application contains 300 tables & 1000procedures. Now am adding additional column to some tables ( say 180 ). Now i need to change the SPs which referes these tables, to accept one extra parameter and the logic of the existing sps need to be changed to include the filter condition based on the new parameter.
Is there anyway that i can automate this or do I need to do it manually by selecting the dependencies of each tale one by one.
Thanks for you help....:)
not enough detailed information. what is the new column? it's purpose? why do the sp's need to be modified? what's new that they need to use the new column to take into consideration?
if you are just adding a datetime column, are you putting a default value of getdate()?
in the title, it kinda of implied the schema(newschema vs dbo?); need some clarity, and real details before we can offer advice.
Lowell
November 27, 2009 at 8:50 am
You cannot rely on object dependency information kept by SQL Server. You must review every piece of source code you have to do what you ask.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
November 29, 2009 at 10:30 pm
Thanks for your time & suggestions.. I already started working by examining each SP seperatly.........
🙂
November 29, 2009 at 11:19 pm
hi,
i can understand what you feel when is there any change into one table you need to do changes into lot of sp for one column .......
i have one suggestion from now on the table in which you think that frequently changes made then make one sp of insertion for that table and use that sp into all other sp but this will be only useful when you don't need to change input parameter means for your table input parameter will be fixed like that.
Raj Acharya
November 29, 2009 at 11:21 pm
hi,
i can understand what you feel when is there any change into one table you need to do changes into lot of sp for one column .......
i have one suggestion from now on the table in which you think that frequently changes made then make one sp of insertion for that table and use that sp into all other sp but this will be only useful when you don't need to change input parameter means for your table input parameter will be fixed like that.
Raj Acharya
November 30, 2009 at 12:11 am
In my organisation, we store all the database objects in version control, its always a best practice to use version control, sp_depends procedure will not return you name of the procedures in which your table is refferd in dynamic query. I would recommend using version control and find the table refrence manually.
November 30, 2009 at 2:22 am
One simple way I think of is to make is easy.
Script out all sps together in one .sql file. Search for tablename in that .sql file where you have done that change.
Than change accordingly change the code.
November 30, 2009 at 2:58 am
if it's sql 2000 then you just need to select all the sp's and then script however its quite tricky in sql 2005, you will have to make use of sys.procedures catalog view to get the name of sp's and then pass the name to sp_helptext... if you need exact script let me knwo
November 30, 2009 at 3:04 am
I am halfway done in my task.. It would be helpful if you pass the script..
Thank you very much for everyone who tried to contribute..:-):-)
November 30, 2009 at 3:24 am
November 30, 2009 at 3:27 am
use this, it will give you text for all the sp's, you can then find name of your table and make the changes accordingly, please ensure that your query result is set to text mode (press ctrl + t)
declare @STR varchar(max)
select @STR = isnull(@str,'') + ' execute sp_helptext ' + name from sys.procedures
exec(@str)
December 1, 2009 at 9:50 am
If you want to script out the stored procedures and other objects to 1 file or multiple files you can do so using the "Generate Scripts" menu command in SSMS 2005.
Here is a site that gives a short tutorial:
Note: I believe a base install of SSMS 2005 without service packs will not have the "file per object" (script to multiple files) option. It will only allow you to script to a single file. That option seems to be added in a later service pack. I am not sure which one but if you have your SSMS updated to the latest one you won't have an issue.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply