开发者

MySql - Create a view with longtext cast into VARCHAR(255)

I am willing to create a view on a table with a longtext column. But I would like that in my view this column be varchar(255). And Yes I would like 开发者_开发技巧to cut the "extra" text.

When I do a substr in the create script the data type is still longtext

Anyone could help me ?

Thanks


How about casting the longtext as a varchar?

 CREATE VIEW foo AS
 SELECT ID, CAST(MyLongText as char(255)) AS MyVarchar
 FROM Table
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜