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 2005 Forums
 Transact-SQL (2005)
 Update query replace string

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2007-11-07 : 14:01:10
i have the following data in column filepath, i would like to replace just the first character from E: to D:

E:\EFiles\APM\10242007.pdf
E:\EFiles\APM\10242007.pdf
E:\EFiles\APM\10242007.pdf

update TAB_ccsNetDocRepository set filepath =

where filepathtype='EF'

Thank you very much for the help.

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2007-11-07 : 14:05:49
Update TAB_ccsNetDocRepository
Set [filepath] = Replace(filepath,'E:', 'D:')
Where Filepathtype = 'EF'
Go to Top of Page

Hommer
Aged Yak Warrior

808 Posts

Posted - 2007-11-07 : 14:07:10
update TAB_ccsNetDocRepository set filepath = 'D' + right(filepath , len(filepath )-1)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-09 : 01:38:42
quote:
Originally posted by Hommer

update TAB_ccsNetDocRepository set filepath = 'D' + right(filepath , len(filepath )-1)



May not work properly if the column is of CHAR data type

Madhivanan

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

- Advertisement -