Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 query for right and left trim

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2008-04-09 : 06:34:27
Hi,
i want to trim the item number example i have item no example
'602-14314w-std' ,'602-564/w-020' but i got one correct that is i got
14314w for the '602-14314w-std' i got wroing for one item that is
i got 564/w- but i need to get 564/w please guide me very urgent

602-14314w-std i need 14314w only
602-564/w-020 i need 564/w only
below i am trying the queryt but i am not get right

SELECT SUBSTR(mtl.SEGMENT1,INSTR(mtl.SEGMENT1,'-')+1, INSTR(mtl.SEGMENT1,'-')+ 3) as segment1 from apps.ja_in_so_picking_lines jispl, apps.mtl_system_items_b mtl
where jispl.INVENTORY_ITEM_ID = mtl.INVENTORY_ITEM_ID
and mtl.ORGANIZATION_ID = 104
and mtl.segment1 like '6%'
and substr(mtl.segment1,3,1)='2'
and jispl.ORGANIZATION_ID in ('128','112')
and jispl.EXCISE_INVOICE_NO is not null


Desikankannan

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-09 : 06:37:44
When is the assignment due?
If you spend some time, you will see that exactly the same question has already been asked here at SQLTeam for not that long ago.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-09 : 09:22:37
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=100426

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-09 : 10:15:35
SELECT PARSENAME(REPLACE(ItemCode, '-', '.'), 2)
FROM Table1


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -