November 4, 2004 at 11:49 am
I was playing with a Functon when I did something I wasn't suppossed to and this was my response.
Server: Msg 443, Level 16, State 2, Procedure fn_fix_case, Line 25
Invalid use of 'RAISEERROR' within a function.
Can anyone else see what is wrong?
November 4, 2004 at 12:03 pm
RAISEERROR ? Shouldn't this be RAISERROR??
Good Hunting!
AJ Ahrens
webmaster@kritter.net
November 4, 2004 at 12:34 pm
What is the E-Mail address for it? sqlwish@microsoft.com ?
I wish there were only such mistakes in SQL Server
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 4, 2004 at 1:09 pm
Nope this is the response SQL Server gave me when I tried to use the RAISERROR method in the code of a UDF.
November 4, 2004 at 1:39 pm
Sorry, I meant there are more severe and not so funny errors than this additional E.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 4, 2004 at 1:40 pm
Oh, and while we're at it. Shouldn't
Functon
read
Function
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 4, 2004 at 1:55 pm
No, I was writing Functons in 2000 thank you. HEHE.
November 4, 2004 at 2:09 pm
http://www.microsoft.com/typography/ctfonts/WordRecognition.aspx
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 4, 2004 at 2:56 pm
Antares686.. on a more serious note, it is forbidden to use raiserror in a UDF. I however found a nice workaround :
CREATE FUNCTION [dbo].[fnTest] ()
RETURNS int AS
BEGIN
--do your stuff
Declare @Error as varchar(100)
--errhandler
if 1=1
begin
--raise the error here--+ 1 cause sqlserver to raise the error because of an invalid cast
set @Error = 'Err raised from fnTest... err message' + 1
end
return 0
END
November 4, 2004 at 3:02 pm
Interesting. I also knew about the RAISERROR thing I was just typing and wasn't thinking about it. Just thought was funny MS had a typo.
And BTW, if you look message 443 is defined in the sysmessages table as
Invalid use of '%s' within a function.
November 4, 2004 at 7:15 pm
I think it's surprising they don't have a lot more... think about how many GB of text they published over the years... if only their software had so few bugs :-).
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply