Click to See Complete Forum and Search --> : SQL Query


sraghunandan
June 2nd, 2005, 11:11 PM
Hi Experts,
I have a table in which one of the column has data like

1
1.2
1.2.6
1.2.6.0
1.2.3
1.1.10.11
1.2.6.0.10

all these are maintained as varchar.

I want to write a query which selects all the records which are subsrings of a given string. If i give the string as 1.2.6.0.10 i should get all the records which are a substring of this.( I want to retreive the records 1, 1.2,1.2.6,1.2.6.0)

Please someone help me in writing a query for this.

Thanks in advance

Regards
Raghu

Krzemo
June 3rd, 2005, 03:22 AM
What kind of database it is ?

sraghunandan
June 3rd, 2005, 03:54 AM
sybase 12.0

Krzemo
June 3rd, 2005, 04:06 AM
I'm not a Sybase expert.... but MsSQL is a child of Sybase so maybe this could work:
SELECT * FROM Mytable WHERE '1.2.6.0.10' LIKE MyColumn+'%'

Hope this helps.