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 |
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-06-27 : 08:14:55
|
| hi,SELECT @SQL = 'select REPLACE('+@t_name+','/','-')'Exec (@SQL)i have a @t_name having names like this EUR/USD and i wanna replace it like this EUR-USD but above statement did not do it. Would you please help? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-06-27 : 08:16:40
|
| select @t_name = REPLACE(@t_name, '/', '-')Peter LarssonHelsingborg, Sweden |
 |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-06-27 : 08:32:41
|
| thanks so much |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-27 : 08:47:01
|
quote: Originally posted by raysefo hi,SELECT @SQL = 'select REPLACE('+@t_name+','/','-')'Exec (@SQL)i have a @t_name having names like this EUR/USD and i wanna replace it like this EUR-USD but above statement did not do it. Would you please help?
If you use Dynamic SQL, then for every single quote you need to double them.SELECT @SQL = 'select REPLACE('''+@t_name+''',''/'',''-'')'Avoid Dynamic SQL as much as possibleMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|