Just remember, unless you add a UNC path to a network folder on the
ExportFile, the output file will be generated and stored on the LOCAL
SQL Server drive...
Good luck!
Trevor
----- Original Message -----
From: Aarons Simon <mssqldba-ezmlmshield-
x42461000.[Email address protected]
Date: Friday, May 27, 2005 8:32 am
Subject: RE: BCP
> Thank you, I will give this a go!
>
> -----Original Message-----
> From: tweir
> [mailto:mssqldba-ezmlmshield-x92054379.[Email address protected]
> Sent: 27 May 2005 13:29
> To: LazyDBA Discussion
> Subject: Re: BCP
>
> You can set up a global variable and, using a dynamic properties
> task,
> change the name of the output file on-the-fly.
>
> Example:
>
> ExecuteSQL step:
> Query: select 'ExportFile_' + convert(char(8),getdate(),112) +
> '.txt'
> as ExportFile
> Click the Parameters button
> Click the Create Global Variables button
> Enter "ExportFile" in the Name column
> Click OK
> Click the Output Parameters tab
> Click the Row Value Button
> Under the Output Global Variables column, click the word <none>
> Select "ExportFile" from the drop down list
> Click OK
> Click OK again
> In your Text File Destination object, click the Properties button
> and
> check the "First row has column names" box
> Add a Dynamic Properties Task
> Click the Add button
> Expand the Connections list, find your text file, double-click the
> word
> DataSource in the list to the right
> On the Source drop-down list, select Global Variable
> On the Variable drop-down list, select "ExportFile"
> Click OK
> Expand the OLE DB Properties List, and click the 1st item "Data
> Source"Double-click the word "Value" in the table to the right
> On the Source drop-down list, select Global Variable
> On the Variable drop-down list, select "ExportFile"
> Click OK
> Add an "On Success" arrow from the dynamic properties task to your
> export task.
>
> Run the package and it will create a file named
> ExportFile_YYYYMMDD.txt
> with the column headings.
>
> Trevor
>
>
> ----- Original Message -----
> From: Aarons Simon <mssqldba-ezmlmshield-
> x67176857.[Email address protected]
> Date: Friday, May 27, 2005 8:03 am
> Subject: BCP
>
> >
> >
> > Afternoon All!
> >
> >
> >
> > When you bcp something as simple as "select * from MyTable" to a
> text> file, can you also export the column headings as well. The
> aim is to
> > export data but the user, who will import to excel during the
> day at
> > some point needs the column headings.
> >
> >
> >
> > Before you ask, I would normally run a DTS with excel export but
> I
> > don'tknow how to dynamically change the date of the excel file,
> > thus not to
> > overwrite...
> >
> >
> >
> > Thanks in advance
> >
> >
> >
> > Simon
> >
> >
> > -------------------------------------------------------------
> > 120 years of the MDU: Still the leading choice
> > -------------------------------------------------------------
> > MDU Services Limited (MDUSL) is authorised and regulated
> > by the Financial Services Authority in respect of insurance
> > mediation activities only. MDUSL is an agent for Zurich
> > Insurance Company and Converium Insurance (UK) Limited. In
> > Ireland, MDUSL is a tied agent of Eagle Star Insurance
> > Company (Ireland) Ltd and is regulated by the Irish Financial
> > Services Regulatory Authority. MDUSL is an agent for the
> > Medical Defence Union (the MDU). The MDU is not an
> > insurance company. The benefits of membership of the MDU
> > are all discretionary and are subject to the Memorandum and
> > Articles of Association.
> >
> > MDU Services Limited Registered in England 03957086.
> > Registered Office: 230 Blackfriars Road London SE1 8PJ
> >
> >
> >
>
______________________________________________________________________>
This email has been scanned by the MessageLabs Email Security System.
> > For more information please visit
> http://www.messagelabs.com/email
> >
>
______________________________________________________________________>
> >
> > -----------------------------------------------------------------
> --
> > --
> > TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> > Website : http://www.LazyDBA.com
> > To unsubscribe: http://www.lazydba.com/unsubscribe.html
> >
> >
>
>
> -------------------------------------------------------------------
> --
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
> -------------------------------------------------------------
> 120 years of the MDU: Still the leading choice
> -------------------------------------------------------------
> MDU Services Limited (MDUSL) is authorised and regulated
> by the Financial Services Authority in respect of insurance
> mediation activities only. MDUSL is an agent for Zurich
> Insurance Company and Converium Insurance (UK) Limited. In
> Ireland, MDUSL is a tied agent of Eagle Star Insurance
> Company (Ireland) Ltd and is regulated by the Irish Financial
> Services Regulatory Authority. MDUSL is an agent for the
> Medical Defence Union (the MDU). The MDU is not an
> insurance company. The benefits of membership of the MDU
> are all discretionary and are subject to the Memorandum and
> Articles of Association.
>
> MDU Services Limited Registered in England 03957086.
> Registered Office: 230 Blackfriars Road London SE1 8PJ
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
>
> -------------------------------------------------------------------
> --
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
MS Sql Server LazyDBA home page