Solved

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

Posted on 2007-11-28
5
505 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:
bhess1 earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now