all groups > sql server mseq > october 2005 >
You're in the

sql server mseq

group:

Fixed length records


Fixed length records Stan
10/31/2005 12:36:06 PM
sql server mseq:
I have to build a text file that has 80 character records. I have a number
of fixed length fields in the file but need to add a 'filler' at the end of
the fields to get to 80. Do I have to create a dummy variable to do that and
if so, how?
Thanks
--
Re: Fixed length records Hugo Kornelis
11/2/2005 12:00:00 AM
[quoted text, click to view]

Hi Stan,

You can't use regular SQL queries to create a text file. You'll have to
use an external utility for that. The ones most commonly used are bcp or
DTS. Both are described in Books Online.

For bcp, the way to add extra space to pad the record length to 80
characters is to use a format file. For DTS, you'll have to look into
the transformation possibilities.

If you need further help, I advise you to post to another newsgroup.
This group is intended for support of English Query, and it's only used
by few people. The group microsoft.public.sqlserver.tools is intended to
support the tools that come with SQL Server (such as bcp and DTS).

Best, Hugo
--

Re: Fixed length records Stan
11/2/2005 1:17:23 PM
Thanks Hugo and thanks for educating me about site usage. We are a shop that
is in the process of converting from a COBOL based legacy system to a SQL
Server environment and we are all new at this.
--
Stan Gosselin


[quoted text, click to view]
Re: Fixed length records Hugo Kornelis
11/3/2005 11:36:47 PM
[quoted text, click to view]

Hi Stan,

Good luck, than. Keep in mind that converting the data will be the
easiest part of the job. Changing your mindset will be the hardest.

COBOL is a third generation, algorithmic language. The basic structure
of Cobol data processing is "read record - check if data qualifies for
operation - do operation - write record - read next record - repeat
until end of file".

SQL is a fourth-generation, declarative language. The basic structure of
data processing in SQL is "do something on all qualifying rows at once".
Quite a difference!

Best, Hugo
--

AddThis Social Bookmark Button