The below MS-SQL update script capitalizes the first letter of a word.
How does this statement look 开发者_如何学Golike in nHibernate HQL (criteria also ok) ?UPDATE T_Example
SET LANG_DE = UPPER(LEFT(LANG_DE, 1)) + RIGHT(LANG_DE, LEN(LANG_DE) - 1)
hibernate hql supports also a function called upper()
see: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html
You can just calculate the value of LANG_DE
in code and pass the value for the update?
Seems like I just have to replace left and right with substring, and len with length.
Looks like this then:
UPDATE T_Example
SET MT_Lang_DE = upper(substring(MT_Lang_DE, 1, 1)) + substring(lower(MT_Lang_DE), 2, length(MT_Lang_DE)-1)
精彩评论