View previous topic :: View next topic
|
Author |
Message |
ami777us
New User
Joined: 06 Apr 2007 Posts: 33 Location: USA
|
|
|
|
I need to add a leading text to an already existing value in a particular column in DB2.
Leading text to add = 'Hello World'
Exisiting text in the column = 'America'
Output Should be 'Hello World America'.
Exisiting text is variable and long enough to use replace function. Is ther any other function in SQL that would solve this. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
update
set column = concat('hello world', substr(column,1,posstr(column,' ')) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
this would be better:
set column = concat('hello world', substr(column,1,posstr(column,' ') - 1) |
|
Back to top |
|
|
|