/******************************************************************************
* author: iret 【程序编程相关:从Internet上抓取指定URL的源码】 【推荐阅读:如何诊断排除基本的 TCP/IP 问题】 * desc: t-sql extractor 【扩展信息:InStrRev 函数 】 * extract the comments and blanks and tabs from the sql statement * 为了比较两个存储过程,或者sql语句是否一致,抽空写了一个可以删除t-sql 语句中的注释与空格的脚本,挺精致的样子. * created date: 2004/10/21 ******************************************************************************/declare @script varchar(8000), @extractedscript varchar(4000)
set @script = ´´ /*从系统表获取存储过程的脚本*/ select @script = @script + [text] from syscomments, sysobjects where syscomments.[id] = sysobjects.[id] and sysobjects.[name] like ´%campa_appsegment´/*标志符*/
declare @inlinecommented bit, @insectioncommented bit, @instring bit, @position int/*当前字符*/
declare @curchar int /*前一个字符*/ declare @prechar intset @inlinecommented = 0
set @insectioncommented = 0 set @instring = 0set @extractedscript = ´´
set @position = 1 set @prechar = nullwhile @position <= datalength(@script)
begin --获取当前字符 ... 下一页