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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Replicate function problem

Author  Topic 

antonopn
Starting Member

2 Posts

Posted - 2008-06-30 : 07:00:33
Hello there, I use a SQL related program. I want to select some data from a table. I want them to be comma seperated. However, I get a lot of empty spaces when I export them to text! The empty spaces are exactly after each comma...

This is the code I use
select replicate(code, 1)+',', replicate(name, 1)+',', replicate(afm, 1)+',', replicate(street1, 1)+',', replicate(zipcode1, 1)+',', replicate(phone11, 1) from customer


Is replicate function useful? I use it correct or no?
I'm a newbie

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-06-30 : 07:04:16
what is your intention of using replicate() here ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 07:49:23
were you learning what replicate does? there doesnt seem to be any need of using it in your code.
Go to Top of Page

antonopn
Starting Member

2 Posts

Posted - 2008-07-01 : 06:45:14
I want to delete blank characters. I thought replicate would be useful. Should I try Ltrim(Rtrim(code)) etc? Would that be better?
Thak you for your answers!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 07:15:30
to remove blank chars, use ltrim or rtrim. replicate does not do that

please refer to Books Online for more information http://msdn.microsoft.com/en-us/library/ms174383.aspx?s=1


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-01 : 07:18:29
quote:
Originally posted by antonopn

I want to delete blank characters. I thought replicate would be useful. Should I try Ltrim(Rtrim(code)) etc? Would that be better?
Thak you for your answers!


blank characters do you mean space? or unprintable chars?
Go to Top of Page
   

- Advertisement -