March 12, 2009 at 1:43 am
Hi All,
We are developing a new stored procedure with using some standard. one of them is 'ALL KEYWORDS SHOULD BE IN UPPER CASE'. Just we are following this standard while writing new procedures.
We have around 700 stored procedure in the database. since auditing is coming now, my manager asked me to cross check each procedure to ensure whether the procedure follow the above standard or not.
is there any automated way to do this?
what i planned was, splitting all the procedure lines as each row. say for example, if any procedure contains 500 rows then it should be splitted into 500 rows. How to do it?
sample:
create procedure p1
(
@eno int
)
as
BEGIN
select eno,ename
FROM emp
Where eno = @eno
End
i need to insert this one into a table like as below
create table proc_cntent_line
(
SNo int,
Text varchar(500)
)
go
1 create procedure p1
2 (
3 @eno int
4 )
5 as
6 BEGIN
7 select eno,ename
8 FROM emp
9 Where eno = @eno
10 End
Inputs are welcome!
karthik
March 12, 2009 at 5:54 am
Hi... my rough and tough idea... sorry if it seems clumsy
Script out a certain number of procedures into SSMS and do a find and replace.
"Keep Trying"
March 12, 2009 at 6:05 am
Here's a quick and dirty method for getting the content of a single sproc into a table, line by line:
IF OBJECT_ID('tempdb..#ProcedureLines') IS NOT NULL
DROP TABLE #ProcedureLines
CREATE TABLE #ProcedureLines (RowID INT identity(1,1), SprocLine VARCHAR(500))
INSERT INTO #ProcedureLines (SprocLine)
EXEC dbo.sp_helptext 'MySproc'
SELECT * FROM #ProcedureLines
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply