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 OriginalGriff 235
1 Sergey Alexandrovich Kryukov 144
2 Rob Philpott 100
3 Peter Leow 70
4 CHill60 70
0 OriginalGriff 6,902
1 Sergey Alexandrovich Kryukov 5,623
2 Maciej Los 3,479
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web02 | 2.8.140721.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