c# - Add statements to existing StoredProcedure in mssql2008 -
what best way alter stored procedure c#(2010) application code @ installation time of add-on.
that means there existing sp's , different add-on's... have check sp. there easy way of doing this? or have read sp_helptext sp.... add or change sentence reader/writer/string... , execute this?
regards oliver
this can achieved in 2 ways.
- run attached query in "reports file" option selected in ssms or press ctrl+shift+f. in output, replace existing column (i assume column exists in procedures , wanted add new column procedure) "that column name" + "new column name". example, if wanted add "coly" existing procedure , "colx" exists in procedure "find , replace" "colx" "colx, coly". need make sure "colx" not used anywhere in condition. should pick column exists in select clause.
- pass 2 values parameters script , script job , produces output.
declare @to_be_replaced_value nvarchar(130) = '' declare @replacing_value nvarchar(130) = '' select replace(m.definition,@to_be_replaced_value,@replacing_value) definition sys.sql_modules m inner join sys.objects o on m.object_id = o.object_id o.type = 'p'
this may not work if assumption not met.
Comments
Post a Comment