Re: bcp
- From: "Hoosbruin" <Hoosbruin@xxxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 11:40:38 -0500
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
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- References:
Relevant Pages
|
Loading