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
 SQL Server Development (2000)
 Changing a field to only use part of it

Author  Topic 

outspaced
Starting Member

21 Posts

Posted - 2006-11-23 : 06:43:59
Hi,

I'd like to update a field in my db so that everything to the right of a / is kept.

So I want:
filename: /path/to/myfile.exe

to become: myfile.exe

Can I do this just using SQL?

Thanks,
Alex

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-23 : 06:49:11
[code]Update Tbl
Set col = Reverse(substring(reverse(col),1, charindex('/',reverse(col))-1))
where col like '%/%'
[/code]


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

outspaced
Starting Member

21 Posts

Posted - 2006-11-23 : 06:55:10
Brilliant, thanks very much!
Go to Top of Page
   

- Advertisement -