Copy/duplicate SQL row with blob/text, How do that?

别说谁变了你拦得住时间么 提交于 2019-12-08 01:04:20

问题


I would like to copy a SQL's row into the same table. But in my table, I've a 'text' column.

With this SQL:

CREATE TEMPORARY TABLE produit2 ENGINE=MEMORY SELECT * FROM produit WHERE pdt_ID = 'IPSUMS';
UPDATE produit2 SET pdt_ID='ID_TEMP';
INSERT INTO produit SELECT * FROM produit2;
DROP TABLE produit2;

I get this error :

#1163 - The used table type doesn't support BLOB/TEXT columns

Here is my table :

pdt_ID varchar(6)
pdt_nom varchar(130)
pdt_stitre varchar(255)
pdt_accroche varchar(255)
pdt_desc text
pdt_img varchar(25)
pdt_pdf varchar(10)
pdt_garantie varchar(80)
edit_ID varchar(7)
scat_ID int(11)
pdt_asso1 char(3)
pdt_asso2 char(3) 
pdt_online tinyint(4)

It's possible to help me to duplicate row ? How?


回答1:


You can't store TEXT-columns (which really are blobs) in memory tables. See here

Depending on your ultimate goal, you may insert a md5-hash of the TEXT-column instead to preserve entity identity. Otherwise you need to put pdt_desc and such into another table and refer to it's primary key - that will save you some storage/memory too.



来源:https://stackoverflow.com/questions/18537586/copy-duplicate-sql-row-with-blob-text-how-do-that

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