Firebird 2.5.2更改Blob子类型 [英] Firebird 2.5.2 change blob subtype

查看:167
本文介绍了Firebird 2.5.2更改Blob子类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改BLOB字段的SUBTYPE?

Is there a posibility to change the SUBTYPE of a BLOB field ?

我有一个带有SUBTYPE BINARY的BLOB,需要将其更改为SUBTYPE TEXT,因为我在BLOB中有一些奇怪的字符,而在带有SUBTYPE TEXT的BLOB中我没有这个问题

I have a BLOB with SUBTYPE BINARY an need to change it to SUBTYPE TEXT, because i get some strange Characters into the BLOB and in a BLOB with SUBTYPE TEXT i don't have this Problem

推荐答案

无法直接更改Blob列的子类型(尝试这样做将产生错误无法更改BLOBCOLUMN列的数据类型.BLOB或ARRAY列不支持更改数据类型." )

Directly altering the subtype of a blob column is not possible (attempts to do this will give the error "Cannot change datatype for column BLOBCOLUMN. Changing datatype is not supported for BLOB or ARRAY columns.")

您将需要

  1. 添加一个带有明确字符集的新列(我根据您的评论假设Windows 1252)

  1. Add a new column with an explicit character set (I am assuming windows 1252 based on your comments)

ALTER TABLE table_name
  ADD blobcolumn_new BLOB SUB_TYPE TEXT CHARACTER SET WIN1252

  • 将数据从旧列复制到新列:

  • Copy the data from the old column to the new column:

    UPDATE table_name SET blobcolumn_new = blobcolumn
    

  • 删除旧列

  • Drop the old column

    ALTER TABLE table_name
      DROP blobcolumn
    

  • 重命名新列

  • Rename the new column

    ALTER TABLE table_name
      ALTER COLUMN blobcolumn_new TO blobcolumn
    

  • 这篇关于Firebird 2.5.2更改Blob子类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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