?
Solved

Define field lengths for MS SQL 2000 DTS bulk export to text file

Posted on 2007-11-28
5
Medium Priority
?
540 Views
Last Modified: 2013-12-18
Hi,

i try to prepare an export of an SQL query into a text file which fields should be of a delimited lenght. The file should be like (the export has 2 fields and if field1 is 10 char and field2 is 8 char):
field1....field2..field1b...field2b. (where points are spaces in the example).

I thought doing this with the SQL 2000 DTS Bulk export bue i don't know where to set the fields length.

Thanks for your help.
 
0
Comment
Question by:jeebee75
5 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 20366729
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 20367483
You do not define the lengths when using a delimited format.  That is the whole point of delimited files.

If I am not understanding, than please indicate what is the current output and the desired output.
0
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 2000 total points
ID: 20369608
Fixed-Length fields is what you are looking for.  Use DTS export, choose to export to a text file, choose fixed-field export, choose <none> for the row delimiter, and export away.
0
 

Author Comment

by:jeebee75
ID: 20372179
Thanks for your posts.
Each record of the output file should be 372 char length. There should be no delimiter between the fields but blanks to complete each field length:

Field      Type      Position      Length
a      char      1      5
b      char      6      6
c      char      12      9
d      char      21      50
e      char      71      50
f      char      121      3
g      char      124      50
h      char      174      50
i      char      224      5
j      char      229      10
k      char      239      10
l      char      249      10
m      char      259      50
n      char      309      13
o      char      322      50

Thanks for your help

0
 

Author Comment

by:jeebee75
ID: 20374881
I found the solution. I had to use the "define columns" (and specify each field length) in the transform data task and choose <none> for the row delimiter as bhess1 told me.

Thanks for your help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question