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.
| Author |
Topic |
|
angusl
Starting Member
6 Posts |
Posted - 2006-03-30 : 04:48:06
|
| Is it possible to use SUBSTRING with update to replace only part of a column , e. g.Update ... set Substring(col1,1,5) = "Fred" where Substring(col1,1,4)="Eric" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-30 : 04:53:05
|
| Post some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-03-30 : 04:53:53
|
| Have a look at the stuff function.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
angusl
Starting Member
6 Posts |
Posted - 2006-03-30 : 08:20:36
|
| Stuff function looks useful, but I need to replace "\\oh6svr" with "\\cqfileclus". Perhaps I could ask for a share to be defined the same length as the original string ?Thanks,Angus |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-30 : 08:27:32
|
Start with thisDeclare @t table(data varchar(100))insert into @tselect 'test' union allselect '"\\oh6svrTest'Select replace(data,'\\oh6svr','\\cqfileclus') from @t MadhivananFailing to plan is Planning to fail |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-30 : 08:28:05
|
| angus,Can u post "some" ( > 1) sample data and the results u expectSrinika |
 |
|
|
angusl
Starting Member
6 Posts |
Posted - 2006-03-30 : 11:39:28
|
| Thanks all, we did use replace and got it sorted.Angus |
 |
|
|
|
|
|