TSQLT unit test - The data types text and text are incompatible in the equal to operator

前提是你 提交于 2019-12-20 04:14:09

问题


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

then

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

--part of the relevant table info

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

回答1:


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

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

See this



来源:https://stackoverflow.com/questions/12285130/tsqlt-unit-test-the-data-types-text-and-text-are-incompatible-in-the-equal-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!