简体   繁体   中英

Remove SQL Comments from Stored Procedure - SQL Server 2008 R2

We would like to remove developer comments from stored procedures for some specific reason.

Is there any mechanism available within SQL Server 2008 R2?

It may be possible to script alter statements based on meta data and strip the comments in the process.

As a starting point take a look at sys.sql_modules

SELECT OBJECT_SCHEMA_NAME(m.object_id) AS [SchemaName],
       OBJECT_NAME(m.object_id) AS [ObjectName], o.type, m.definition
FROM   sys.sql_modules m 
inner join sys.all_objects o  on o.object_id = m.object_id 
where o.is_ms_shipped = 0 
order by OBJECT_NAME(m.object_id) ;

But I don't know why you don't just manually script the sp's to a text file and strip it before running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM