Error with function when exporting with SQL Export Wizard

0

I'm trying to export some entries from a database to a .txt file. I'm only exporting certain columns and this works fine with:

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

However I also need to remove all html tags within the text when exporting so I've got this function to do so:

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

And this in my export query:

 SELECT dbo.udf_StripHTML([Category3])

Any suggestions what the below issue is?

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)
sql
sql-server
asked on Stack Overflow Oct 23, 2015 by MariaL • edited Oct 23, 2015 by MusicLovingIndianGirl

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0