2012年3月11日星期日

Fixed length records

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
Stan Gosselin
On Mon, 31 Oct 2005 12:36:06 -0800, Stan wrote:

>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
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
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||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
"Hugo Kornelis" wrote:

> On Mon, 31 Oct 2005 12:36:06 -0800, Stan wrote:
>
> 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
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||On Wed, 2 Nov 2005 13:17:23 -0800, Stan wrote:

>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.
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
(Remove _NO_ and _SPAM_ to get my e-mail address)

没有评论:

发表评论