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
 String Question

Author  Topic 

rpc86
Posting Yak Master

200 Posts

Posted - 2006-05-16 : 01:47:17
Hi guys,

For example, the user input the string ABCDE-6. How to remove -6 from the string?

The result should be like this:

ABCDE

Thank you

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-16 : 01:51:25
somthing like this


Declare @var Varchar(10)

Set @var = 'ABCDE-6'

Select Replace(@var,'-6','')

Select Left(@var,CharIndex('-',@var)-1)



If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

rpc86
Posting Yak Master

200 Posts

Posted - 2006-05-16 : 02:07:54
Ok, thank you. It's working now.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-17 : 03:46:47
Do you want to remove the numbers from the string?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56713

Madhivanan

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

- Advertisement -