Hi all,
My company haa a big detabase and i am working on a marketing and sale repor
t.
i had lot of junk data like:
D-CAB PZTN4-3553-01 TOYOTA,Plate Hook A,7.0mm,(SET)
TOYOTA LINER D-CAB (PZO53-0K003), Plate, Robot Hook A, 7.0 MM.
i want to take out only ( D-CAB) but i coudnt make it from the string.
Can u all help me.
thanx
waiting for solution
from
SufianIf you need the first word from every row, you can use something like
this:
SELECT ProductName, LEFT(ProductName,
ISNULL(NULLIF(CHARINDEX(' ',ProductName),0),
LEN(ProductName))) FROM Northwind..Products
Razvan|||Dear thax for ur suggestion/.
but please read the questation i had asked to write a query in which where
ever the D-CAB is there it return me that not only the first.
if can be done in many ways.
but i need what i asked so please if u know then pls.
thanx
--
waiting for solution
from
Sufian
"Razvan Socol" wrote:
> If you need the first word from every row, you can use something like
> this:
> SELECT ProductName, LEFT(ProductName,
> ISNULL(NULLIF(CHARINDEX(' ',ProductName),0),
> LEN(ProductName))) FROM Northwind..Products
> Razvan
>|||Is this what you need:
SELECT CASE
WHEN ProductName LIKE '%D-CAB%' THEN 'D-CAB'
WHEN ProductName LIKE '%Something else%' THEN 'Something else'
-- and so on...
END
FROM YourTable
If it's anything like that, I'd recommend that you create a table with
the keywords and use it in an UPDATE query to fill a new column in the
main table.
Razvan|||The following will update a field named CarName and remove D-CAB.
update
MyTable
set
CarName = replace(CarName,'D-CAB','')
"Mohd Sufian" <sufian@.aeroflex.co.th> wrote in message
news:609D681C-7EDE-4E87-80D5-204E437AB453@.microsoft.com...
> Hi all,
> My company haa a big detabase and i am working on a marketing and sale
report.
> i had lot of junk data like:
> D-CAB PZTN4-3553-01 TOYOTA,Plate Hook A,7.0mm,(SET)
> TOYOTA LINER D-CAB (PZO53-0K003), Plate, Robot Hook A, 7.0 MM.
> i want to take out only ( D-CAB) but i coudnt make it from the string.
> Can u all help me.
> thanx
>
>
> --
> waiting for solution
> from
> Sufian
Sunday, February 19, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment