looking for flat file utility that displays character positions

Posted on 2011-04-29
Last Modified: 2012-05-11
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
Question by:lottidah
    LVL 51

    Accepted Solution

    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...


    Author Closing Comment

    Thank you, that is much easier!

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
    Via a live example, show how to shrink a transaction log file down to a reasonable size.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now