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 |
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2009-11-17 : 13:12:26
|
| I am new to SQL, and have no prior coding experiance. This may be a dumb question; but I am wondering about the order of operations in a replace function.For example:In a set of data with value ab can IREPLACE(REPLACE(stringab, 'b', 'a'), 'aa', 'works') and get "works" as a result? |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-11-17 : 13:25:42
|
| innermost to outermost is the order of operationso REPLACE(REPLACE(stringab, 'b', 'a'), 'aa', 'works') REPLACE(REPLACE(stringab, 'b', 'a') -- do this 1st, 'aa', 'works') |
 |
|
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2009-11-17 : 13:39:10
|
| cool, so it would replace 'b' with 'a', then have a data set of 'aa', and then replace the 'aa' with 'works' yeah? |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-11-17 : 15:05:46
|
| yep. ez to test too, try it out |
 |
|
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2009-11-17 : 15:10:00
|
| Yeah, the data I am working with is pretty massive, and I wanted to make sure I'm doing it right the first time. I will try it from now.Thanks for your help guys! |
 |
|
|
|
|
|
|
|