简体   繁体   English

将NTEXT和nvarchar(255)转换为nvarchar(max)的问题

[英]Issue converting NTEXT & nvarchar(255) to nvarchar(max)

How can I convert an NTEXT column to NVARCHAR(MAX)? 如何将NTEXT列转换为NVARCHAR(MAX)?

I have 4 databases in which there is a table that exists in all four. 我有4个数据库,其中有一个表存在于所有四个中。 Inside of this table there exists a Notes column of type NTEXT except in one database where that column is nvarchar(255) . 在这个表的内部存在一个类型为NTEXTNotes列, 除了在一个数据库中,该列是nvarchar(255)

So: 所以:

  • 3 NTEXT 3 NTEXT
  • 1 nvarchar(255) 1 nvarchar(255)

My ETL takes data from these four tables and puts them into one table where the Notes column is of type nvarchar(max) . 我的ETL从这四个表中获取数据并将它们放入一个表中,其中Notes列的类型为nvarchar(max)

I didn't realize that one column was nvarchar(255) until my ETL didn't work because all four tables are supposed to be identical in structure. 我没有意识到一列是nvarchar(255)直到我的ETL不起作用,因为所有四个表都应该在结构上相同。

Error: 错误:

[Source DB [25]] Error: There was an error with Source DB.Outputs[OLE DB Source Output].Columns[Notes] on Source DB.Outputs[OLE DB Source Output]. [源DB [25]]错误:源DB.Outputs [OLE DB源输出] .Columns [Notes]在源DB.Outputs [OLE DB源输出]上出错。 The column status returned was: "DBSTATUS_UNAVAILABLE". 返回的列状态为:“DBSTATUS_UNAVAILABLE”。

I'm guessing this is the issue since the error wasn't specific. 我猜这是问题,因为错误并不具体。 How can I convert this column to nvarchar(max) ? 如何将此列转换为nvarchar(max)

在oledb源代码中,从表中写入一个select并将列转换为NTEXT,即

SELECT ..., Convert(ntext, Notes) as Notes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM