sql >> Base de Datos >  >> RDS >> Sqlserver

newid () dentro de la función del servidor sql

aquí hay una solución inteligente:

create view getNewID as select newid() as new_id

create function myfunction ()
returns uniqueidentifier
as begin
   return (select new_id from getNewID)
end

que no puedo tomar crédito por. lo encontré aquí:http://omnibuzz-sql.blogspot.com/2006/07/accessing-non-deterministic-functions.html

-no