dbTalk Databases Forums  

Export Variable length field

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Export Variable length field in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stephen Costanzo
 
Posts: n/a

Default Export Variable length field - 10-21-2005 , 03:18 PM






I have a package set up to export a single column in a table, this column
is varchar(4096). The output from the package is a fixed width field of
4096. My goal is to export lines of various lengths (10, 200, 1500, 200). Is
this possible?

I have found many referenced to reading a variable length using DTS but not
one on exporting.

Thanks in advance




Reply With Quote
  #2  
Old   
SQL
 
Posts: n/a

Default RE: Export Variable length field - 10-21-2005 , 03:37 PM






use the left and/or substring functions

http://sqlservercode.blogspot.com/

"Stephen Costanzo" wrote:

Quote:
I have a package set up to export a single column in a table, this column
is varchar(4096). The output from the package is a fixed width field of
4096. My goal is to export lines of various lengths (10, 200, 1500, 200). Is
this possible?

I have found many referenced to reading a variable length using DTS but not
one on exporting.

Thanks in advance





Reply With Quote
  #3  
Old   
Stephen Costanzo
 
Posts: n/a

Default Re: Export Variable length field - 10-21-2005 , 04:36 PM



The problem with this is, I don't know the correct length of each of the
rows in the table. Some are 10, some are 200. They are written to the
varchar field correctly as that length. It is the export that fails.
Additionally, I cannot RTRIM the field as the last 5 characters of that 200
record can be spaces. Therefore the record would be incorrectly truncated to
195 characters as opposed to 200 characters.

These values are going to an old mainframe system where it reads the first 5
characters of the line, knows the type of information and expects (based
upon its information) a certain number of characters after the first 5.
Therefore if we send 195 as opposed to 200, the mainframe process will
terminate due to a record length failure.

"SQL" <SQL (AT) discussions (DOT) microsoft.com> wrote

Quote:
use the left and/or substring functions

http://sqlservercode.blogspot.com/

"Stephen Costanzo" wrote:

I have a package set up to export a single column in a table, this
column
is varchar(4096). The output from the package is a fixed width field of
4096. My goal is to export lines of various lengths (10, 200, 1500,
200). Is
this possible?

I have found many referenced to reading a variable length using DTS but
not
one on exporting.

Thanks in advance







Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Export Variable length field - 10-22-2005 , 05:20 AM



Hello Stephen,

I am unsure as to what you need here.


Do you have a variable width column in a table and want to export at a fixed
width value of 4096?
Do you have a 4096 length column and you want to export to varying widths
of column (10,200,1500)?


If you can show us a before and after this would help.

Thanks

Allan



Quote:
The problem with this is, I don't know the correct length of each of
the rows in the table. Some are 10, some are 200. They are written to
the varchar field correctly as that length. It is the export that
fails. Additionally, I cannot RTRIM the field as the last 5 characters
of that 200 record can be spaces. Therefore the record would be
incorrectly truncated to 195 characters as opposed to 200 characters.

These values are going to an old mainframe system where it reads the
first 5 characters of the line, knows the type of information and
expects (based upon its information) a certain number of characters
after the first 5. Therefore if we send 195 as opposed to 200, the
mainframe process will terminate due to a record length failure.

"SQL" <SQL (AT) discussions (DOT) microsoft.com> wrote in message
news:89B8BB24-14B2-483C-9F21-5064345029DC (AT) microsoft (DOT) com...

use the left and/or substring functions

http://sqlservercode.blogspot.com/

"Stephen Costanzo" wrote:

I have a package set up to export a single column in a table, this

column

is varchar(4096). The output from the package is a fixed width field
of 4096. My goal is to export lines of various lengths (10, 200,
1500,

200). Is

this possible?

I have found many referenced to reading a variable length using DTS
but

not

one on exporting.

Thanks in advance




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.