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 |
|
kiruthika
Yak Posting Veteran
67 Posts |
Posted - 2008-01-04 : 04:51:26
|
| Hi! create table login1(userid varchar(20),pass varchar(20))insert login1 values('kee rthi @ gmail.com', 'keerthi')insert login1 values('aji@gmail.com', 'aji')insert login1 values('aaa@gmail.com', 'aaa')insert login1 values('bb b@gmail.com', 'bbb')select * from login1I want to remove the spaces between userid field like(keerthi@gmail.com)output:userid----------keerthi@gmail.comaji@gmail.comaaa@gamil.combbb@gamil.comI tried this querey but not workingselect replace(userid,'','') as userid from login1How can i acheive this? Please help meThanks! |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-01-04 : 05:11:24
|
| [code]select replace(userid,Char(32),'') as userid from login1[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2008-01-04 : 05:14:44
|
| also those so called spaces might not be spaces Char(32) they could be Char(0) or something similar - because the replace using ' ' should do the trick.Duane. |
 |
|
|
kiruthika
Yak Posting Veteran
67 Posts |
Posted - 2008-01-04 : 05:29:15
|
quote: Originally posted by harsh_athalye
select replace(userid,Char(32),'') as userid from login1 Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
Thanks Harsh and Ditch!Thank You so much!kiruthika! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-04 : 07:41:57
|
quote: Originally posted by kiruthika Hi! create table login1(userid varchar(20),pass varchar(20))insert login1 values('kee rthi @ gmail.com', 'keerthi')insert login1 values('aji@gmail.com', 'aji')insert login1 values('aaa@gmail.com', 'aaa')insert login1 values('bb b@gmail.com', 'bbb')select * from login1I want to remove the spaces between userid field like(keerthi@gmail.com)output:userid----------keerthi@gmail.comaji@gmail.comaaa@gamil.combbb@gamil.comI tried this querey but not workingselect replace(userid,'','') as userid from login1How can i acheive this? Please help meThanks!
Also select replace(userid,'','') as userid from login1 wont do anything. You forget to specify spaceMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|