How to show CLOB type in a SELECT in SQL Server?
clob, database, sql-server, t-sql
Solution
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 ;
Problem
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. For example if I use `SELECT *`, under the CLOB type every data is like: ``` CLOB, 8 Bytes CLOB, 15 Bytes CLOB, 9 Bytes ``` But I just want to see the content of the CLOB data. I tried: ``` SELECT DBMS_LOB.SUBSTR(ClobColumnName, 20 ,1) ``` And it doesn't work, error is: Error Code: 4121, SQL State: S1000 Cannot find either column "DBMS_LOB" or the user-defined function or aggregate "DBMS_LOB.SUBSTR", or the name is ambiguous. So can I ask what's the syntax for direct display a CLOB data in a query? I'm using SQL Server with `dbVisualizer`.