We have a function dbo.GENERATE_UUID does exactly what it says. I want to maintain the name for compatiblity, but would rather use the built in NEWID(). However, I cannot do this
alter function dbo.GENERATE_UUID ()
returns uniqueidentifier
as begin
return (SELECT NEWID())
end
because "Invalid use of a side-effecting operator 'newid' within a function."
So I would like to instead
drop function dbo.GENERATE_UUID
and
create synonym dbo.GENERATE_UUID for NEWID
but when I
select dbo.GENERATE_UUID()
I get, "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.GENERATE_UUID", or the name is ambiguous."
I also tried variations on
create synonym dbo.GENERATE_UUID for master.sys.NEWID
Is there anyway to create a SYNONYM for this sort of TSQL built in function? Am interested in any version of SQL Server post 2k5.