使用SQL导出向导导出时出现函数错误

时间:2015-10-23 10:15:01

标签: sql sql-server

我试图将某些条目从数据库导出到.txt文件。我只导出某些列,这适用于:

SELECT
Category1, Category2, Category3, Category4
FROM dbo.tbl1
WHERE Category3 = 'JP-4'
AND Category4 > 4

但是我还需要在导出时删除文本中的所有html标签,所以我已经有了这个功能:

CREATE FUNCTION [dbo].[udf_StripHTML]
(@HTMLText VARCHAR(MAX))
RETURNS VARCHAR(MAX)
AS
BEGIN
DECLARE @Start INT
DECLARE @End INT
DECLARE @Length INT
SET @Start = CHARINDEX('<',@HTMLText)
SET @End = CHARINDEX('>',@HTMLText,CHARINDEX('<',@HTMLText))
SET @Length = (@End - @Start) + 1
WHILE @Start > 0
AND @End > 0
AND @Length > 0
BEGIN
SET @HTMLText = STUFF(@HTMLText,@Start,@Length,'')
SET @Start = CHARINDEX('<',@HTMLText)
SET @End = CHARINDEX('>',@HTMLText,CHARINDEX('<',@HTMLText))
SET @Length = (@End - @Start) + 1
END
RETURN LTRIM(RTRIM(@HTMLText))
END
GO

这在我的导出查询中:

 SELECT dbo.udf_StripHTML([Category3])

以下问题是什么建议?

0x80040E14  Description: "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.udf_StripHTML", or the name is ambiguous.".
 (SQL Server Import and Export Wizard)

0 个答案:

没有答案