블로그 이미지
Sunny's

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

'프로시져'에 해당되는 글 1

  1. 2009.11.17 [MSSQL] 저장 프로시저 정보(명세서)
2009. 11. 17. 14:32 MSSQL


/******************************************************************************************
 저장 프로시저 정보
*******************************************************************************************/
SELECT
 CASE WHEN nType = 0 THEN A.name ELSE '' END ProcName
, CASE WHEN nType = 1 THEN b.name ELSE '' END ParaName
, C.name +
 CASE WHEN UPPER(C.name) IN ('CHAR','NCHAR','VARCHAR','NVARCHAR') THEN '(' +
CONVERT(VARCHAR(8), B.max_length) + ')'
   ELSE ''
 END TypeName
, REPLACE(D.Definition, char(10) + char(13) ,  char(10) + char(13) ) Script
FROM ( 
 SELECT object_id, name, nType
 FROM sys.objects CROSS JOIN (SELECT 0 nType UNION ALL SELECT 1) B) A
 LEFT OUTER JOIN sys.sql_modules D
  ON A.object_id = D.object_id
   AND A.nType = 0
 LEFT OUTER JOIN sys.parameters B
  ON A.object_id = B.object_id
   AND A.nType = 1
 LEFT OUTER JOIN sys.types C
  ON B.system_type_id = C.system_type_id
   AND B.user_type_id = C.user_type_id
WHERE OBJECTPROPERTY(A.object_id, 'IsProcedure') = 1
 AND OBJECTPROPERTY(A.object_id, 'IsMSShipped') = 0
 AND CASE WHEN nType = 1 THEN b.name ELSE '' END IS NOT NULL
ORDER BY A.name, nType, ISNULL(B.parameter_id, 0)

posted by Sunny's
prev 1 next