• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

looking for flat file utility that displays character positions

I am creating a flat file by pulling data into a table via a query, then using the bcp command to pull it into a flat file.  My query adds the required spaces to each field.  But it was all done manually and prone to error.  I'm looking for a utility that loads the flat file and displays the data with starting/ending character positions.  Does that make sense?

If I was told that the last_name field should start on position 71 and should end on position 100, I need to verify that I've really done that.  

Is there a utility that can load my flat file and visually display the character positions of the data?  I would assume maybe a really good text editor would do this but I'm not aware of any and apparently not searching on the right terms in Google.

Thank you
1 Solution
HainKurtSr. System AnalystCommented:
instead of using this

select 'HainKurt'

use this

select Left('HainKurt' + replicate(' ',20), 20)

in your query... so it will make sure it is 20 char in length padded with " " to the right...

or use

select CAST('HainKurt' as CHAR(20))

and then export it to flat file, then everything will be in place...

lottidahAuthor Commented:
Thank you, that is much easier!

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now