dbTalk Databases Forums  

output header and trailer?

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


Discuss output header and trailer? in the microsoft.public.sqlserver.dts forum.



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

Default output header and trailer? - 06-04-2004 , 11:56 AM






Is there a way to output header and trailer info when exporting a text file when using a DTS package? Any suggestions? Has anyone done this before


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

Default Re: output header and trailer? - 06-04-2004 , 01:39 PM






Personally I would export to 3 files

Header.txt
Data.txt
Footer.txt

I would then do

COPY Header.txt + Data.Txt + Footer.txt AllTogether.txt



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


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

Quote:
Is there a way to output header and trailer info when exporting a text
file when using a DTS package? Any suggestions? Has anyone done this
before?
Quote:



Reply With Quote
  #3  
Old   
softrock
 
Posts: n/a

Default Re: output header and trailer? - 06-04-2004 , 02:36 PM



Thanks Allan. Can all of this be done using DTS? Preferably one package? I'm new to DTS, just got handed the job.

Reply With Quote
  #4  
Old   
Kevin3NF
 
Posts: n/a

Default Re: output header and trailer? - 06-04-2004 , 03:09 PM



I have seen some documentation about writing headers in the "pre source
data" phase of a multi-phase DTS pump, but was never able to get it working.

Allan...have you done anything like that?

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com/NewsGroups.htm
www.DallasDBAs.com/forum - new DB forum for Dallas/Ft. Worth area DBAs.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Personally I would export to 3 files

Header.txt
Data.txt
Footer.txt

I would then do

COPY Header.txt + Data.Txt + Footer.txt AllTogether.txt



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"softrock" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:E8C305C1-AF64-4D82-980F-1ECC140CBBF3 (AT) microsoft (DOT) com...
Is there a way to output header and trailer info when exporting a text
file when using a DTS package? Any suggestions? Has anyone done this
before?






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

Default Re: output header and trailer? - 06-04-2004 , 04:40 PM



Yep you can do that as well. I prefer the other method as I think it
cleaner.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Kevin3NF" <KHill (AT) NopeIDontNeedNoSPAM3NF-inc (DOT) com> wrote

Quote:
I have seen some documentation about writing headers in the "pre source
data" phase of a multi-phase DTS pump, but was never able to get it
working.

Allan...have you done anything like that?

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com/NewsGroups.htm
www.DallasDBAs.com/forum - new DB forum for Dallas/Ft. Worth area DBAs.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23dJiJKmSEHA.3596 (AT) tk2msftngp13 (DOT) phx.gbl...
Personally I would export to 3 files

Header.txt
Data.txt
Footer.txt

I would then do

COPY Header.txt + Data.Txt + Footer.txt AllTogether.txt



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"softrock" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:E8C305C1-AF64-4D82-980F-1ECC140CBBF3 (AT) microsoft (DOT) com...
Is there a way to output header and trailer info when exporting a text
file when using a DTS package? Any suggestions? Has anyone done this
before?








Reply With Quote
  #6  
Old   
Darren Green
 
Posts: n/a

Default Re: output header and trailer? - 06-06-2004 , 04:58 AM



In message <urK1j$mSEHA.3580 (AT) TK2MSFTNGP09 (DOT) phx.gbl>, Kevin3NF
<KHill (AT) NopeIDontNeedNoSPAM3NF-inc (DOT) com> writes
Quote:
I have seen some documentation about writing headers in the "pre source
data" phase of a multi-phase DTS pump, but was never able to get it working.

Allan...have you done anything like that?

Has anyone got a working example of this method? Never got it working
myself.


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



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

Default Re: output header and trailer? - 06-06-2004 , 09:40 AM



I remember reading something sometime that this was possible but then
remembered I'd played but couldn't remember if I got it to work. The main
problem is that once the package fires it opens the connection and text
files being as they are do not like you trying to open them again. This is
where I believe we get the "Permission Denied" error.

Maybe there is a property of the text file that allows the text file to be
used by two people at the same time ????


Anyway this was my test and no it didn't work


Function PreSourceMain()

dim fso, tStream

set fso = CREATEOBJECT("Scripting.FileSystemObject")

set tStream = fso.Opentextfile("c:\HeaderAndFooter.txt",2)

tStream.WriteLine "Header Row"

tStream.Close

PreSourceMain = DTSTransformstat_OK
End Function


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
In message <urK1j$mSEHA.3580 (AT) TK2MSFTNGP09 (DOT) phx.gbl>, Kevin3NF
KHill (AT) NopeIDontNeedNoSPAM3NF-inc (DOT) com> writes
I have seen some documentation about writing headers in the "pre source
data" phase of a multi-phase DTS pump, but was never able to get it
working.

Allan...have you done anything like that?


Has anyone got a working example of this method? Never got it working
myself.


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org




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.