Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Easy function question

Author  Topic 

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-06-02 : 03:51:33
Hello,

Can anyone tell me why this function does not work?
I`m new to sql functions.

ALTER FUNCTION [dbo].[fnFormat]

(
@format nvarchar(1000)
)

RETURNS nvarchar(1000)

AS
BEGIN

SET @format = Replace(LOWER(@format),'_',' ')
Return @format

END

Cannot perform alter on 'dbo.fnFormat' because it is an incompatible object type.

greetings, joris

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-02 : 03:58:38
ALTER FUNCTION [dbo].[fnFormat]
(
@format nvarchar(1000)
)
RETURNS nvarchar(1000)

AS
BEGIN
Return Replace(LOWER(@format),'_',' ')
END


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-06-02 : 04:02:34
Still the same error message...
Go to Top of Page

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-06-02 : 04:05:21
OK it's fixed

"you can't use "Alter Function" to change a scalar function to a table function. Use "Drop Function" and "Create Function"."
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-06-02 : 05:26:00
quote:
OK it's fixed

"you can't use "Alter Function" to change a scalar function to a table function. Use "Drop Function" and "Create Function"."


In what possible way does that statement have any relevance to what you told us about in your first post?

There is no mention of a table valued function there.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-02 : 05:41:27
They expect us to be mind-readers?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-06-10 : 07:18:41
quote:
Originally posted by Transact Charlie

quote:
OK it's fixed

"you can't use "Alter Function" to change a scalar function to a table function. Use "Drop Function" and "Create Function"."


In what possible way does that statement have any relevance to what you told us about in your first post?

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION




The error code I mentioned in the first post was

Cannot perform alter on 'dbo.fnFormat' because it is an incompatible object type.

I found the solution on the base of that code :)
No one expects you to be mind readers. Told you i am new to it.
Go to Top of Page
   

- Advertisement -