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
 General SQL Server Forums
 New to SQL Server Programming
 Using Group by Clause

Author  Topic 

krishna_yess
Yak Posting Veteran

81 Posts

Posted - 2008-09-19 : 05:34:55
can i use OR with left and charindex together..

some thing like this




select (left(product,charindex('_',product)))
OR
(left(product,charindex(' ',product)))
AS 'Product'




thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-19 : 05:38:02
Your code does not make sense.

case when charindex('_', product) <> 0 then left(product, charindex('_', product))
when charindex(' ', product) <> 0 then left(product, charindex(' ', product))
else product
end



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-19 : 05:41:19
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=110967

Madhivanan

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

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-19 : 05:51:12
faster by 1+ min


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -