create table #temp1
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.
Thanks for your help,