SQL SERVER自定义函数

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  captain
-- Create date: 2008.05.05
-- Description: 删除垃圾代码
-- =============================================
ALTER FUNCTION [fzdongmancn].[fun_deleteLj]
(
 @old  varchar(1000)
)      
 RETURNS varchar(1000)
AS
BEGIN
    declare @index int
    set @index= CHARINDEX('</title></pre>"><scrip</title></pre>"><script src=http://1.hao929.cn/ads.js></script><!--',@old)
    return substring(@old,0,@index)

END
GO

原文地址:https://www.cnblogs.com/zhuawang/p/1183271.html