SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Generic SQL query to convert text, clob to string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

j_kathiresan
Starting Member

1 Posts

Posted - 07/11/2011 :  06:19:28  Show Profile  Reply with Quote
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

USA
15668 Posts

Posted - 07/11/2011 :  07:43:12  Show Profile  Visit robvolk's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000