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
 Import/Export (DTS) and Replication (2000)
 OSQL and Data Extraction

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-09-04 : 11:22:20
umbi writes "Hi,

I am trying extract data in a comma separated format into a text file. The database is Microsoft SQL Server. I am using OSQL and running it in the command line mode with the necessary arguments. I am able to extract the data. However, every field in the data file seems to be blank padded to the lenght of the column defined in the table. However I may try to use RTRIM, SUBSTR etc. still the data fields are fixed length. For example a col. defined as CHAR(15) has only a single character data. But the file holds 15 character positions (1 character and 14 spaces). How can I avoid these extra spaces. It unnecessarily increases the size of the file.

Your help is much apprciated.

Cheers
Umbi"

nr
SQLTeam MVY

12543 Posts

Posted - 2002-09-04 : 12:49:06
Have you tried bcp instead?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -