Click here to Skip to main content
12,622,913 members (30,177 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# .NET SQL-Server
Hi,

I have 100 sp which contain lot of update statement. I want to insert one line(Audit Sp Calling) below to that all update statement.

Example

Create Procedure TestSp
Begin

Line 1 ....
Line 2 ...
Line 3 Update Test Set
Line 4 Status='A'
Line 5 Where ID=1
Line 6
Line 7 select * from Test
Line 8 .....
Line 9 ....

Now i want to insert one line in Line 6 "Call SP Sample line"

Line 1 ....
Line 2 ...
Line 3 Update Test Set
Line 4 Status='A'
Line 5 Where ID=1
Line 6 Call SP Sample Line
Line 7
Line 8 select * from Test
Line 9 .....
Line 10 ....


Thanks
Posted 14-Mar-12 3:27am
Updated 14-Mar-12 3:29am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

read each file line by line in a stringbuilder.
In the stringbuilder class you can insert a line see here[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

use below line :
EXEC SP_NAME
  Permalink  
Comments
senthil sennu 14-Mar-12 8:47am
   
All the sp we have it as .sql file. No need for EXEC SP_NAME. I cant able do the changes manually as their are more than 500 sp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161128.1 | Last Updated 14 Mar 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100