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 |
|
cheesythestar
Starting Member
3 Posts |
Posted - 2009-01-30 : 16:26:51
|
| I need to replace certain characters in the field and then use upto 5 characters from the field's value to compare it with a value with some other table. What is the syntax to use both replace and left in this..It would be great if I am able to get some help in this regard. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
cheesythestar
Starting Member
3 Posts |
Posted - 2009-01-30 : 16:35:41
|
| I found the syntax to write using left first and then REPLACE. However i would first like the REPLACE commands to give the output and then i would need to use LEFT operator on it.. Thanks |
 |
|
|
Skorch
Constraint Violating Yak Guru
300 Posts |
Posted - 2009-01-30 : 16:51:20
|
| So something like this?SELECT LEFT(REPLACE('abcdefg','abc','123'),4)Some days you're the dog, and some days you're the fire hydrant. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Rajesh Jonnalagadda
Starting Member
45 Posts |
Posted - 2009-01-31 : 07:02:47
|
| Try this,SELECT REPLACE('TEST_FORUMS', '_', '+')SELECT LEFT('TEST_FORUMS', 4)Rajesh Jonnalagadda[url="http://www.ggktech.com"]GGK TECH[/url] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-31 : 08:12:40
|
quote: Originally posted by cheesythestar I found the syntax to write using left first and then REPLACE. However i would first like the REPLACE commands to give the output and then i would need to use LEFT operator on it.. Thanks
show some sample data and output you want if you need exact solution. |
 |
|
|
cheesythestar
Starting Member
3 Posts |
Posted - 2009-02-05 : 13:14:19
|
| Thanks for the suggestions.. This one worked ..SELECT LEFT(REPLACE('abcdefg','abc','123'),4).... |
 |
|
|
|
|
|
|
|