Solved

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

Posted on 2007-11-28
5
504 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

747 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

9 Experts available now in Live!

Get 1:1 Help Now