deploy failed

Topics: Developer Forum
Aug 13, 2009 at 5:44 PM

Hello,

Got this error when I try to deploy MsSqlSpatial on my server Sql 2005 :



C:\Program Files\Microsoft SQL Server\80\Tools\MsSqlSpatial>msscmd -deploy -serv
er=MYSERVER  -db=TESTBASE

Exception non gérée : System.ApplicationException: Exception occured executing s
cript:
/* Drop the assembly */
IF EXISTS (SELECT name FROM sys.assemblies WHERE name = N'MsSqlSpatialLibrary')
BEGIN

/*
MsSqlSpatialLibrary : Assambly Name (string)
MsSqlSpatialLibrary : Assembly Name (literal)
ST : Schema Name
0=1 : Full Drop? (TRUE or FALSE)
*/

        /* Drop non-assembly objects */
        IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[ST].
[AddGeometryQueryFunctions]') AND type in (N'P', N'PC'))
                DROP PROCEDURE [ST].[AddGeometryQueryFunctions]

        IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[ST].
[DropGeometryQueryFunctions]') AND type in (N'P', N'PC'))
                DROP PROCEDURE [ST].[DropGeometryQueryFunctions]

        IF 0=1 AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID
(N'[ST].[GEOMETRY_COLUMNS]') AND type in (N'U'))
                DROP TABLE [ST].[GEOMETRY_COLUMNS]

        IF 0=1 AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID
(N'[ST].[SPATIAL_REF_SYS]') AND type in (N'U'))
                DROP TABLE [ST].[SPATIAL_REF_SYS]

        DECLARE @error int
        SET @error = 0

        /* Drop the assembly user defined aggregates, triggers, functions and pr
ocedures */
        DECLARE @moduleId sysname
        DECLARE @moduleName sysname
        DECLARE @moduleType char(2)
        DECLARE @moduleClass tinyint
        DECLARE @moduleSchemaId int
        DECLARE assemblyModules CURSOR FAST_FORWARD FOR
                SELECT t.object_id, t.name, t.type, t.parent_class as class, NUL
L as schema_id
                        FROM sys.triggers t
                        INNER JOIN sys.assembly_modules m ON t.object_id = m.obj
ect_id
                        INNER JOIN sys.assemblies a ON m.assembly_id = a.assembl
y_id
                        WHERE a.name = N'MsSqlSpatialLibrary'
                UNION
                SELECT o.object_id, o.name, o.type, NULL as class, o.schema_id
                        FROM sys.objects o
                        INNER JOIN sys.assembly_modules m ON o.object_id = m.obj
ect_id
                        INNER JOIN sys.assemblies a ON m.assembly_id = a.assembl
y_id
                        WHERE a.name = N'MsSqlSpatialLibrary'
        OPEN assemblyModules
        FETCH NEXT FROM assemblyModules INTO @moduleId, @moduleName, @moduleType
, @moduleClass, @moduleSchemaId
        WHILE (@error = 0 AND @@FETCH_STATUS = 0)
        BEGIN
                DECLARE @dropModuleString nvarchar(256)
                IF (@moduleType = 'AF') SET @dropModuleString = N'AGGREGATE'
                IF (@moduleType = 'TA') SET @dropModuleString = N'TRIGGER'
                IF (@moduleType = 'FT' OR @moduleType = 'FS') SET @dropModuleStr
ing = N'FUNCTION'
                IF (@moduleType = 'PC') SET @dropModuleString = N'PROCEDURE'
                IF (@moduleType = 'TA' AND @moduleClass = 0)
                BEGIN
                        SET @dropModuleString = N'DROP ' + @dropModuleString + '
 [' + REPLACE(@moduleName, ']', ']]') + ']' + N' ON DATABASE'
                END
                ELSE
                BEGIN
                        SET @dropModuleString = N'DROP ' + @dropModuleString + '
 [' + SCHEMA_NAME(@moduleSchemaId) + '].[' + REPLACE(@moduleName, ']', ']]') + '
]'
                END
                EXEC sp_executesql @dropModuleString
                FETCH NEXT FROM assemblyModules INTO @moduleId, @moduleName, @mo
duleType, @moduleClass, @moduleSchemaId
        END
        CLOSE assemblyModules
        DEALLOCATE assemblyModules

        /* Drop the assembly user defined types */
        DECLARE @typeId int
        DECLARE @typeName sysname
        DECLARE @schemaId int
        DECLARE assemblyTypes CURSOR FAST_FORWARD
                FOR SELECT t.user_type_id, t.name, t.schema_id
                        FROM sys.assembly_types t
                        INNER JOIN sys.assemblies a ON t.assembly_id = a.assembl
y_id
                        WHERE a.name = N'MsSqlSpatialLibrary'
        OPEN assemblyTypes
        FETCH NEXT FROM assemblyTypes INTO @typeId, @typeName, @schemaId
        WHILE (@error = 0 AND @@FETCH_STATUS = 0)
        BEGIN
                DECLARE @dropTypeString nvarchar(256)
                SET @dropTypeString = N'DROP TYPE [' + SCHEMA_NAME(@schemaId) +
'].[' + REPLACE(@typeName, ']', ']]') + ']'
                EXEC sp_executesql @dropTypeString
                FETCH NEXT FROM assemblyTypes INTO @typeId, @typeName, @schemaId

        END
        CLOSE assemblyTypes
        DEALLOCATE assemblyTypes

        /*  Drop the assembly */
        IF (@error = 0)
                DROP ASSEMBLY [MsSqlSpatialLibrary] WITH NO DEPENDENTS
END

IF 0=1 AND EXISTS (SELECT * FROM sys.schemas WHERE name = N'ST')
        EXEC sys.sp_executesql N'DROP SCHEMA [ST]'

USE master

IF 0=1 AND EXISTS (SELECT name FROM sys.syslogins WHERE name=N'MsSqlSpatialLibra
ryLogin')
        DROP LOGIN [MsSqlSpatialLibraryLogin]

IF 0=1 AND EXISTS (SELECT name FROM sys.asymmetric_keys WHERE name=N'MsSqlSpatia
lLibraryKey')
        DROP ASYMMETRIC KEY [MsSqlSpatialLibraryKey]
 ---> System.Data.SqlClient.SqlException: 'SCHEMA_NAME' n'est pas un nom de fonc
tion reconnu.
'SCHEMA_NAME' n'est pas un nom de fonction reconnu.
Ligne 92 : syntaxe incorrecte vers 'ASSEMBLY'.
Ligne 101 : syntaxe incorrecte vers 'LOGIN'.
Ligne 104 : syntaxe incorrecte vers 'ASYMMETRIC'.
   à System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean
 breakConnection)
   à System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
 Boolean breakConnection)
   à System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObje
ct stateObj)
   à System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmd
Handler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsP
arserStateObject stateObj)
   à System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, B
oolean async)
   à System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult resu
lt, String methodName, Boolean sendToPipe)
   à System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   à Deployment.RunScript(String script, SqlCommand command)
   --- Fin de la trace de la pile d'exception interne ---
   à Deployment.RunScript(String script, SqlCommand command)
   à Deployment.DeployAssembly(String assemblyFilename, String connectionString,
 String database, String deployPermission)
   à MsSqlSpatialConsole.Program.DeployAssembly(String connectionString, String
database, ArgParser arg)
   à MsSqlSpatialConsole.Program.Main(String[] args)