Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify Column length in text file

Status
Not open for further replies.

balistikb

Technical User
Nov 12, 2002
177
US
I am using a DTS to export from an Access table to a text file. How can I specify the length of each field once it is in the text file?
HELP
 
Why would you need the length of each field? If you export the data in a comma or tab delimited format, it does not matter, more or less, the size of the fields. SQL Server can import the file based on the format choosen.

Thanks

J. Kusch
 
Actually I am exporting to a text file and that text file is being used for another application that needs specific column width when importing that information.
 
You then may want to post that question in the DTS or more the Access forum since this forum stricyly deals w/ SQL Server Programming. Good Luck!

Thanks

J. Kusch
 
SELECT '"' + SPACE(20-LEN('this')) + 'this' + '"'
, '"' + SPACE(20-LEN('is')) + 'is' + '"'
, '"' + SPACE(50-LEN('a')) + 'a' + '"'
, '"' + SPACE(50-LEN('test')) + 'test' + '"'

This is just an example. I am not sure if this is the best way but it works for me. Just replace the text with the fields you want in the query.

You don't need the '"' in the query, they are just to make the result of this example more visible

Atomic Wedgie
 
Hmmm,

I am not sure if the query will also work within access.

Atomic Wedgie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top