View previous topic :: View next topic
|
Author |
Message |
i_suman
New User
Joined: 01 Mar 2005 Posts: 20
|
|
|
|
HI ,
I've a requirement where I have to include carriage return (character) at the end of each sentence and that whole string needs to be inserted in a column of varchar(3900). How to achive this through spufi?
The string I want to insert,for example
This is John.<carriage return>How are you doing?<carriage return>Call me if possible.<carriage return>
FYI, The hexa decimal equivalent of carriage return ---> 0D
Any help is appreciated
Thanks in advance |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Just include the character as a literal:
Code: |
select col1, x'0d',
col2, x'0d',
col3
from the_table
where . . . .
|
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
In order to due it on an insert you would have concantenate the data and a x'0d' or specify all the data in hex and just add x'0d' where appropriate. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Thanks Craig,
My bad - i didn't read the request properly. . .
I only saw the "spufi" and the c/r. . .
d |
|
Back to top |
|
|
i_suman
New User
Joined: 01 Mar 2005 Posts: 20
|
|
|
|
Craq,
I tried as you said even before posting this question. But I'm unsuccessful. I tried something like this where it is throwing either -103 or -110 (tried giving x'0d' in several ways like X"0D" etc). I am not sure where I am missing the syntax. Complete query with syntax,which is workable is much appreciated.
INSERT INTO devl.table1
(name,
date,
description
)
values
('john',
'1998-01-01',
'This is John.x'0D'How are you doing?x'0D''
)
Thanks for your replies. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Try this:
'This is John.' || x'0D' || 'How are you doing?' || x'0D''
My system is offline so i'm not able to test just now. If the vertical bars do not work, try CONCAT instead. |
|
Back to top |
|
|
i_suman
New User
Joined: 01 Mar 2005 Posts: 20
|
|
|
|
Hi D.sch,
It seems its working. I tried it on db2 udb (on my computer). However I have to try it through spufi when I have system available. I will update you.
Thanks a lot for your time and valuble answers. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
Sorry about the early misdirection. . .
d |
|
Back to top |
|
|
|