thanks again...
"Allan Mitchell" <allan@no-spam.sqldts.com> wrote in message
news:OBFi$kdTFHA.548@tk2msftngp13.phx.gbl...
> Unfortunately not, AFAIK bcp will not generate the column names for you.
> There may be something you could do with a view and a union though.
>
> --
>
> 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@Kconline.com> wrote in message
> news:eNedndU-MvKLKO7fRVn-gA@kconline.com...
>>
>> That would work
>>
>> much thanks !!!!!!!
>>
>> Would there be anyway to get COLUMN headings with this scenario...
>>
>>
>> "Allan Mitchell" <allan@no-spam.sqldts.com> wrote in message
>> news:eWk%23jzYTFHA.2420@TK2MSFTNGP12.phx.gbl...
>>> 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@Kconline.com> wrote in message
>>> news:wMydnb31X4_a4u7fRVn-ug@kconline.com...
>>>> 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@no-spam.sqldts.com> wrote in message
>>>> news:%23ASkJrUTFHA.2916@TK2MSFTNGP15.phx.gbl...
>>>>> 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@Kconline.com> wrote in message
>>>>> news:PMydnSKz_NHFXO_fRVn-1A@kconline.com...
>>>>>>
>>>>>>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>