Click here to Skip to main content
Rate this: bad
good
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 2:27am
Edited 14-Mar-12 2:29am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

use below line :
EXEC SP_NAME
  Permalink  
Comments
senthil sennu at 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
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  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 418
1 OriginalGriff 344
2 George Jonsson 233
3 Shemeemsha RA 138
4 Animesh Datta 130
0 OriginalGriff 6,179
1 Sergey Alexandrovich Kryukov 5,616
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 14 Mar 2012
Copyright © CodeProject, 1999-2014
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