Re: bcp




That would work

much thanks !!!!!!!

Would there be anyway to get COLUMN headings with this scenario...


"Allan Mitchell" <allan@xxxxxxxxxxxxxxxxxx> wrote in message
news:eWk%23jzYTFHA.2420@xxxxxxxxxxxxxxxxxxxxxxx
> Would not something like this work.
>
> strCmdLine = "bcp ""SELECT * FROM pubs..authors ORDER BY au_lname""
> queryout ""c:\MyFile" +
> REPLACE(DTSGlobalVariables("DateVariable").Value,"/","") + ".txt"" -
> . -T -c"
>
>
> --
>
> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
> www.SQLDTS.com - The site for all your DTS needs.
> www.SQLIS.com - SQL Server 2005 Integration Services.
> www.Konesans.com
>
>
> "Hoosbruin" <Hoosbruin@xxxxxxxxxxxx> wrote in message
> news:wMydnb31X4_a4u7fRVn-ug@xxxxxxxxxxxxxxx
>> I've tried to get this to work with no luck. Can you give me a few
>> snippets of code to create multiple output files that each have dynamic
>> names at execution.
>>
>> Thanks
>>
>>
>>
>>
>>
>> "Allan Mitchell" <allan@xxxxxxxxxxxxxxxxxx> wrote in message
>> news:%23ASkJrUTFHA.2916@xxxxxxxxxxxxxxxxxxxxxxx
>>> Can you not use this article to do what you want?
>>>
>>> How to manipulate the Execute Process task.
>>> (http://www.sqldts.com/default.aspx?251)
>>>
>>> --
>>>
>>> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
>>> www.SQLDTS.com - The site for all your DTS needs.
>>> www.SQLIS.com - SQL Server 2005 Integration Services.
>>> www.Konesans.com
>>>
>>>
>>> "Hoosbruin" <Hoosbruin@xxxxxxxxxxxx> wrote in message
>>> news:PMydnSKz_NHFXO_fRVn-1A@xxxxxxxxxxxxxxx
>>>>
>>>>
>>>> I'm using BCP with queryout and exporting data from a table to a .csv
>>>> file. Using this as a template it works fine but is there anyway to get
>>>> the column headings along with the data. I'm using this method because
>>>> I can create different output filenames. I have a DTS to do this but I
>>>> can't get Global Variables to work creating different filenames.
>>>>
>>>> DECLARE @FileName varchar(50),
>>>> @bcpCommand varchar(2000)
>>>>
>>>> SET @FileName =
>>>> REPLACE('c:\authors_'+CONVERT(char(8),GETDATE(),1)+'.txt','/','-')
>>>>
>>>> SET @bcpCommand = 'bcp "SELECT * FROM pubs..authors ORDER BY au_lname"
>>>> queryout "'
>>>> SET @bcpCommand = @bcpCommand + @FileName + '" -T -c'
>>>>
>>>> PRINT @bcpCommand
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: INSERT Problem
    ... >>Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... >>> INSERT Staging VALUES ...
    (microsoft.public.sqlserver.dts)
  • Re: Disabling DTS Bulk insert task
    ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... >> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ...
    (microsoft.public.sqlserver.dts)
  • Re: Dynamically set up DTS Transformations?
    ... > Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)> www.SQLDTS.com - The site for all your DTS needs. ... >> package each time but set the source table and destination text file ...
    (microsoft.public.sqlserver.dts)
  • Re: SQL Trigger Current Row ID
    ... Have you seen the INSERTED and DELETED tables available to you in a trogger. ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ...
    (microsoft.public.sqlserver.dts)
  • Re: Cluster Service remain on starting state after quorum log corr
    ... > You have to ask Microsoft Product Support for the Fix. ... > Mike Epprecht, Microsoft SQL Server MVP ... >>> Mike Epprecht, Microsoft SQL Server MVP ...
    (microsoft.public.sqlserver.clustering)

Loading