TSQLT 单元测试 - 数据类型文本和文本在等于运算符中不兼容 [英] TSQLT unit test - The data types text and text are incompatible in the equal to operator

查看:18
本文介绍了TSQLT 单元测试 - 数据类型文本和文本在等于运算符中不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 AssertEqualsTable 收到此错误数据类型文本和文本在等于运算符中不兼容."

I am getting this error from AssertEqualsTable "The data types text and text are incompatible in the equal to operator."

然后

'TableCompare' 过程试图返回 NULL 状态,这是不允许的.将返回状态 0."

"The 'TableCompare' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead."

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';

--部分相关表格信息

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

推荐答案

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

I don't think you can compare text field values, which would explain the error.

此外,不推荐使用 text 数据类型,取而代之的是 varchar(MAX).

Also, the text data type is deprecated in favor of varchar(MAX).

请参阅

这篇关于TSQLT 单元测试 - 数据类型文本和文本在等于运算符中不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆