Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Generic SQL query to convert text, clob to string

Author  Topic 

j_kathiresan
Starting Member

3 Posts

Posted - 2011-07-11 : 06:19:28
Hi All,

I've declared a Hibernate column as type "text" which creates the column as "longtext" in MySQL, "nvarchar" in SQL Server and "CLOB" in Oracle.

I need to write a SQL query which works for all databases.

Ex: to_char() it doesn't works in MySQL but works fine in Oracle.

Please guide with a generic query which supports all the databases.

Thanks,
Kathir.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-07-11 : 07:43:12
Look at the CAST() function, I believe that is ANSI standard and should work in all of the products you mentioned. Since each data type you mentioned is used for character data it should implicitly convert to a string in Hibernate.

If not you'll have better luck posting in a forum dedicated to Hibernate, SQLTeam is a Microsoft SQL Server site only.
Go to Top of Page
   

- Advertisement -