如何在SQL Server的SELECT中显示CLOB类型? [英] How to show CLOB type in a SELECT in SQL Server?

查看:772
本文介绍了如何在SQL Server的SELECT中显示CLOB类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表,其中有一列CLOB类型的数据,它们都很短,不超过20个字节,但是我看不到CLOB数据中的实际字符串。

I have a table with one column of CLOB type data, they are all very short no more than 20 bytes, however I cannot see the actual string in the CLOB data.

例如,如果我使用 SELECT * ,则在CLOB类型下,每个数据如下:

For example if I use SELECT *, under the CLOB type every data is like:

CLOB, 8 Bytes
CLOB, 15 Bytes
CLOB, 9 Bytes

但是我只想查看CLOB数据的内容。

But I just want to see the content of the CLOB data.

我尝试过:

SELECT DBMS_LOB.SUBSTR(ClobColumnName, 20 ,1)

并且不起作用,错误是:

And it doesn't work, error is:


错误代码:4121,SQL状态:S1000

找不到列 DBMS_LOB或用户定义的函数或聚合 DBMS_LOB.SUBSTR,或者名称不明确。

那么我能问一下在查询中直接显示CLOB数据的语法是什么吗?

So can I ask what's the syntax for direct display a CLOB data in a query?

我正在将SQL Server与 dbVisualizer 。

I'm using SQL Server with dbVisualizer.

推荐答案

我想出了一个解决方案。应该有更好的方法,请在注释中显示更多可能的解决方案。

I figured out one solution. There should be better ways, please show more possible solutions in the comments.

SELECT CAST(ClobColumnName AS VARCHAR(50)) AS ClobColumnName ;

这篇关于如何在SQL Server的SELECT中显示CLOB类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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