Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need getting a part of data

Status
Not open for further replies.

baran121

Programmer
Sep 8, 2005
337
TR
hi i have a dynamic data i want to get a part of it, there is an example

set @str='deneme renk:Tutamaklar sarı RAL 1018 toz kaplamalı#'
insert #deger_gec (deger_gec) values (@str)

select 'x' from #deger_gec where deger_gec like '%RAL%'


i need to get data RAL 1018
the rule is if there is a RAL, so when i got RAL data i have to get RAL 1018
i dont know what i have to do later?
thank you for helping...




 
Code:
Select deger_gec from #deger_gec where deger_gec like '%RAL%'

This will give you all deger_rec values containing RAL.

Now you also want to extract RAL from that and the next 5 chars, right? Or could the number be longer? For the case of 'RAL' plus space plus 4 digits, you could do:
Code:
Select SUBSTRING(deger_gec,PATINDEX('%RAL%',deger_gec),8) from #deger_gec where deger_gec like '%RAL%'

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top