1
Vote

Error script a SQL 2008 database that contains User Defined Table Types

description

I have a SQL 2008 database that contains User Defined Table Types. ScriptDB is aborting with the following output (no problem with SQL 2008 databases that don't contain UDTTs):
 
 
C:\APP_RDM_ScriptDb>ScriptDb.exe -con:server=SQL6422DC\CDEF;database=App_RDM_Ctr
l;trusted_connection=yes -outdir:\usbosdata01\vbshare\App_RDM\scriptdumps\APP_R
DM_09 -ScriptAsCreate -NoCollation -IncludeDatabase -Purge

Exception caught in Main()

Script failed for UserDefinedDataType 'dbo.UDT_KeyAccount'.
 
Microsoft.SqlServer.Management.Smo.FailedOperationException
 
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptImpl(ScriptingOption
s so)
at Microsoft.SqlServer.Management.Smo.UserDefinedDataType.Script(ScriptingOpt
ions scriptingOptions)
at Elsasoft.ScriptDb.DatabaseScripter.ScriptUddts(Boolean verbose, Database d
b, ScriptingOptions so, String outputDirectory)
at Elsasoft.ScriptDb.DatabaseScripter.GenerateDatabaseScript(Database db, Str
ing outputDirectory, Boolean purgeDirectory, Boolean scriptData, Boolean verbose
, Boolean scriptProperties)
at Elsasoft.ScriptDb.DatabaseScripter.GenerateScripts(String connStr, String
outputDirectory, Boolean scriptAllDatabases, Boolean purgeDirectory, Boolean scr
iptData, Boolean verbose, Boolean scriptProperties)

at Elsasoft.ScriptDb.Program.Main(String[] args)

The UserDefinedDataType '[dbo].[UDT_KeyAccount]' cannot be scripted as its data
is not accessible.
 
Microsoft.SqlServer.Management.Smo.FailedOperationException
 
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyColle
ction depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(Urn[] urns, Sql
SmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns, SqlSmoObjec
t[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(SqlSmoObject[] objects)
 
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptImplWorker(Scripting
Options so)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptImpl(ScriptingOption

s so)

Property SystemType is not available for UserDefinedDataType '[dbo].[UDT_KeyAcco
unt]'. This property may not exist for this object, or may not be retrievable du
e to insufficient access rights.
 
Microsoft.SqlServer.Management.Smo.PropertyCannotBeRetrievedException
 
at Microsoft.SqlServer.Management.Smo.PropertyCollection.HandleNullValue(Int3
2 index)
at Microsoft.SqlServer.Management.Smo.PropertyCollection.GetPropertyObject(In
t32 index)
at Microsoft.SqlServer.Management.Smo.UserDefinedDataType.GetTypeDefinitionSc
ript(ScriptingOptions so, SqlSmoObject oObj, String sTypeNameProperty, Boolean b
SquareBraketsForNative)
at Microsoft.SqlServer.Management.Smo.UserDefinedDataType.ScriptDdlGreaterEqu
al9(StringBuilder sb, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.UserDefinedDataType.ScriptCreate(String
Collection queries, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(Dependenc
yCollection depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyColle

ction depList, SqlSmoObject[] objects)

comments