尽管已声明,但找不到数据类型“ UserDefinedType”

时间:2019-09-18 12:58:51

标签: sql sql-server azure-sql-database roundhouse

以下脚本创建一个存储过程(mysproc.sql):

/* A table type with 1 column (NVARCHAR(200)) of names */
CREATE TYPE [SchemaName].[NameList] AS TABLE(
    [Name] [NVARCHAR](200)
)
GO

ALTER PROCEDURE [SchemaName].[AlterNameAccess] 
@pNames AS [SchemaName].[NameList] READONLY
    AS
    BEGIN

        -- Logic Here ...

    END
GO

运行上述脚本后,又运行了另一个调用存储过程的脚本,如下所示(runsproc.sql):

DECLARE @Names AS [SchemaName].[NameList]

INSERT INTO @Names -- Logic ...

EXEC [SchemaName].[AlterNameAccess] 
@pNames = @Names

RoundhousE用于按顺序运行这些脚本...在本地,RoundhousE将正确运行这些脚本,但是在Azure上运行RoundhousE时,声明DECLARE @Names AS [SchemaName].[NameList]时会发生错误...说用户定义的类型不是被定义,尽管实际上已被定义。

这是RoundHousE提供的错误消息:

2019-09-17 18:52:04,358 [INFO ] -  Running runsproc.sql on (local)
2019-09-17 18:52:06,686 [ERROR] - 
*** Error executing file 'runsproc.sql'. ***

2019-09-17 18:52:06,701 [ERROR] - Database deployment encountered an error. You were running in a transaction though, so the database should be in the state it was in prior to this piece running. This does not include a drop/create or any creation of a database, as those items can not run in a transaction.
System.Data.SqlClient.SqlException: Column, parameter, or variable #4: Cannot find data type SchemaName.NameList.
Must declare the table variable "@Names".
Must declare the table variable "@Names".
Parameter or variable '@Names' has an invalid data type.

0 个答案:

没有答案