Can I create a synonym for the t-sql built-in function?

We have a function dbo.GENERATE_UUID does exactly what it says. I want to keep the name for compatibility, but would rather use the built-in NEWID (). However i cant do that

alter function dbo.GENERATE_UUID ()
returns uniqueidentifier
as begin
   return (SELECT NEWID())
end

because "Invalid use of the" newid "operator in a function."

So, I would like instead

drop function dbo.GENERATE_UUID

and

create synonym dbo.GENERATE_UUID for NEWID

but when I

select dbo.GENERATE_UUID() 

I get: "I can not find the dbo column, nor the user-defined function, nor aggregate dbo.GENERATE_UUID, or the name is ambiguous."

I also tried options on

create synonym dbo.GENERATE_UUID for master.sys.NEWID

Is there a way to create SYNONYM for this kind of built-in TSQL function? I'm interested in any version of SQL Server post 2k5.

+4
1

SQL- . SQL Scalar .

MSDN

-1

Source: https://habr.com/ru/post/1548555/


All Articles