question

Håkan Winther avatar image
Håkan Winther asked

Create user defined system function?

I am creating [some user defined system procedures for maintenance][1] in the master database and now I want to add a user defined system function [(like you could do it in SQL 200)][2], but it doesn't work anymore and I tried to find a solution to this, but couldn't find any reference on how to do it. I have tried a couple of variations of this code... use master go EXEC SP_CONFIGURE 'ALLOW UPDATES', 1 --this is deprecated in future release RECONFIGURE WITH OVERRIDE GO create function dbo.fn_test() RETURNS DATE AS BEGIN RETURN GETDATE() END GO EXEC sp_ms_marksystemobject 'fn_test' GO use sqltest go select dbo.fn_test() go use master Go drop function fn_test EXEC SP_CONFIGURE 'ALLOW UPDATES', 0 --this is deprecated in future release RECONFIGURE WITH OVERRIDE ...but i keep getting errors like this > Cannot find either column "dbo" or the > user-defined function or aggregate > "sys.fn_test", or the name is > ambiguous. [1]: http://ask.sqlservercentral.com/questions/17589/create-system-stored-procedures [2]: http://www.sqlservercentral.com/Forums/Topic892425-149-1.aspx
sql-server-2008system-functions
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sp_lock avatar image
sp_lock answered
Håkan Looks like it is for SPs/Tables only... Never had to do it for functions... [social link][1] [1]: http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/d49ff86b-c518-458e-a6e1-a74d7865c8d9
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.