Parsing a string

Last Post 02 Jun 2006 11:01 AM by natasha. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
natasha
New Member
New Member

--
02 Jun 2006 11:01 AM
create table #temp1
(Id int,
address_description varchar(255))

insert #temp1 values (123,'rocky dr unit 111 floor 2 apt 2A jdskakafd')
insert #temp1 values (345,'rocky drive unt 144 flr 2 apt 33B sec B hajskhks')
insert #temp1 values (567,'misery rd ut 666 flor 10 sec 55A hdsfkl')

select * from #temp1

what I am trying to achieve is write a function that will extract
needed information based on a parameter.
eg if I pass "UNIT" and ID = 123 then it should look at all the combination of the word
UNIT as in UNIT , UNT , UT and return me the value of unit for a given ID
which will be 111

If I pass FLOOR and ID = 345 then it should return values of floor "2"
If I pass Section and ID = 567 then it should return values of section "B".
It is safe to assume that there will be a space between a string and its value.

Any ideas???
Thanks for your help,
Nat
You are not authorized to post a reply.

Acceptable Use Policy