create script error | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

create script error

I am trying to get the create script fot a function, but it’s giving me the following , how can i get the script by overcoming this error.
error:=================================== Script failed for UserDefinedFunction ‘dbo.test_decrypt_KEY’. (Microsoft.SqlServer.Smo) ——————————
For help, click:…EvtID=Script UserDefinedFunction&LinkId=20476 ——————————
Program Location: at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(Urn[] urns, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ScriptGenerator.ScriptCreate(Server server, Urn[] urns, SqlScriptOptions options)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ScriptMenuHelper.OnScriptToNewWindow(Object sender, EventArgs args) =================================== Property TextHeader is not available for UserDefinedFunction ‘[dbo].[test_decrypt_KEY]’. This property may not exist for this object, or may not be retrievable due to insufficient access rights. The text is encrypted. (Microsoft.SqlServer.Smo)

Is this function encrypted?
If yes I don’t think you can script it in SSMS…
Also check the permission for the user to script the function, and check whether DBO schema exists on that server. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.