473,385 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

GENERAL SQL Question

A client gave a spreadsheet that has this column format:

..u29034c.ccridl.djkcjd

I need to parse out only the characters between the first two periods
in the column using only SQL.

Any suggestions?

DB2 8.2 on AIX

Thanks in advance!

Martin

Apr 11 '06 #1
5 1174
create user defined function in C/ C++ or java to parse the string?

regards,

mehmet

Apr 11 '06 #2

You can use UDFs. Create an user defined function in C/C++ or java to
parse the string? Register it in the database.

Then you would be able to call it in the SQL stmts.

Regards,

Mehmet

Apr 11 '06 #3
In article <11**********************@g10g2000cwb.googlegroups .com>,
ma*********@yahoo.com says...
A client gave a spreadsheet that has this column format:

.u29034c.ccridl.djkcjd

I need to parse out only the characters between the first two periods
in the column using only SQL.

Any suggestions?

DB2 8.2 on AIX

Thanks in advance!

Martin


drop table t1;

create table t1 (c1 char(40));

insert into t1 (c1) values ('.u29034c.ccridl.djkcjd'),
('.gfovfgpt.cdft.fdfgrt');

select substr(c1,posstr(c1,'.') + 1,
posstr(substr(c1,posstr(c1,'.') + 1), '.')
- posstr(c1,'.') )
from t1;

1
----------------------------------------
u29034c
gfovfgpt

2 record(s) selected.
Apr 11 '06 #4
A little generalization.
I'm afraid real data would not include following data(first period is
not in first position.)
Example: ('alpha.gfovfgpt.cdft.fdfgrt')

But, if there are such data, this would be better.
------------------- Commands Entered -------------------------
select C1
, substr(c1,posstr(c1,'.') + 1,
posstr(substr(c1,posstr(c1,'.') + 1), '.') -1)
from t1;
--------------------------------------------------------------------

C1 2
---------------------------------------- ------------------------------
..u29034c.ccridl.djkcjd u29034c

..gfovfgpt.cdft.fdfgrt gfovfgpt

alpha.gfovfgpt.cdft.fdfgrt gfovfgpt
3 record(s) selected.

Apr 12 '06 #5
Thank you all for your postings. That was exactly the information I
needed!!

Martin

Apr 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: John Salerno | last post by:
After my last post, I thought of another question as a result of the following: ------------------------------ Mike Meyer wrote: > John Salerno <johnjsal@NOSPAMgmail.com> writes: > > >>So...
3
by: JezB | last post by:
What's the generally accepted approach for using Styles and Stylesheets in a web application based on .aspx files, Web Controls, User Controls, and code-behind modules (c# in my case)? Most style...
2
by: ZorpiedoMan | last post by:
I'm new to the world of sockets, and this question is not VB specific: If multiple clients access the same server on the same port, and the server is set up to do some async communication, does...
105
by: Christoph Zwerschke | last post by:
Sometimes I find myself stumbling over Python issues which have to do with what I perceive as a lack of orthogonality. For instance, I just wanted to use the index() method on a tuple which does...
1
by: Mark Fink | last post by:
Hi there, unfortunately I am new to Jython and my "Jython Essentials" book is still in the mail. I looked into the Jython API Doc but could not find the information. I am porting a Python...
0
by: Yong | last post by:
I'm not getting any reply to my previous thread so I'm stating a new one. I get a General Network Error due to my SqlCommand object not having a big enough CommandTimeout to complete very long...
4
by: Viviana Vc | last post by:
Hi all, I've read the WindowsVistaUACDevReqs.doc documentation and I have done different small tests on Vista to understand the bahaviour and now I have a few questions. 1) If I create a...
2
by: sharan | last post by:
Hello Friends I have a problem in Data Structure (In C) i want to emplement a General tree having three child nodes of each parent node ...please send me any simple Example( code) by which i can...
2
by: SpotNet | last post by:
Scott M. Have your experiences shown you that programmers may give the best computer advice, analysis, and solutions even at the worst of times, for a PC user? ;~D Haven't crossed many Network...
3
by: =?Utf-8?B?Ymxi?= | last post by:
I am posting to the general discussion group - but I cannot find my postings... or replies...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.