I just encountered a strange behavior of SMO scripting.
Let's assume have a very simple user defined function called 'F_Test'. Output of UserDefinedFunction.Script():
[font="Courier New"]SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
-- =============================================
-- Author:
-- Create date:
-- Description:
-- =============================================
CREATE FUNCTION F_Test ( )
RETURNS int
AS
BEGIN
RETURN 1
END[/font]
When the function is renamed using SQL server mgmt studio (or even by calling UserDefinedFunction.Rename() ) to "F_Test99", the script output of Script() is still the same as the one above. Meaning, that the script still refers to the name F_Test instead of F_Test99