-->

TSQLT单元测试 - 数据类型的文本和文本是在等于操作员不相容(TSQLT unit test -

2019-07-31 09:10发布

我正在从AssertEqualsTable这个错误“的数据类型的文字和文字都在等于运算符不兼容。”

然后

“在‘​​TableCompare’过程试图返回NULL的状态,这是不允许的。状态0将被替代返回。”

select   *
    into #Actual
    from [dbo].[InvoiceOut];

--make expected table an empty table of #actual's structure because we truncate so it should be empty.
    SELECT TOP(0) *
    INTO #Expected
    FROM #Actual;

EXEC tSQLt.AssertEqualsTable '#Expected', '#Actual';

相关表格信息的--Part

CREATE TABLE [dbo].[InvoiceOut](
...
    [InsertField] [text] NULL,
    [DeductibleText] [text] NULL,
    [BarcodeText] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

Answer 1:

我不认为你可以比较文本字段值,这可以解释的错误。

此外,文本数据类型是有利于为varchar(MAX)已过时。

见这



文章来源: TSQLT unit test - The data types text and text are incompatible in the equal to operator