|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Insert String into text file using bcpHi All,
I have a string 'ABC 12345 678910 XXXX '. I want to insert it into the test.txt file using bcp command. How do I do that. Thanks for your help. One way:
bcp "select 'ABC 12345 678910 XXXX '" queryout test.txt -c -T Of course the choice of -T or -U -P is up to you, and -S is up to you. Another approach would be to make that SELECT a view, adding a column name of course, and BCP out from the view. Roy Harvey Beacon Falls, CT On 17 Aug 2006 06:53:50 -0700, ntuye***@yahoo.com wrote: Show quote >Hi All, > >I have a string 'ABC 12345 678910 XXXX '. I want to insert it into >the test.txt file using bcp command. How do I do that. > >Thanks for your help. It works. Thank You.
Roy Harvey wrote: Show quote > One way: > > bcp "select 'ABC 12345 678910 XXXX '" queryout test.txt -c -T > > Of course the choice of -T or -U -P is up to you, and -S is up to you. > > Another approach would be to make that SELECT a view, adding a column > name of course, and BCP out from the view. > > Roy Harvey > Beacon Falls, CT > > On 17 Aug 2006 06:53:50 -0700, ntuye***@yahoo.com wrote: > > >Hi All, > > > >I have a string 'ABC 12345 678910 XXXX '. I want to insert it into > >the test.txt file using bcp command. How do I do that. > > > >Thanks for your help. I'm glad it worked for you.
Of course there really isn't any need to involve BCP in the process at all. This seems to do the same job: echo select ABC 12345 678910 XXXX >test.txt Roy On 17 Aug 2006 07:51:52 -0700, ntuye***@yahoo.com wrote: Show quote >It works. Thank You. > > >Roy Harvey wrote: >> One way: >> >> bcp "select 'ABC 12345 678910 XXXX '" queryout test.txt -c -T >> >> Of course the choice of -T or -U -P is up to you, and -S is up to you. >> >> Another approach would be to make that SELECT a view, adding a column >> name of course, and BCP out from the view. >> >> Roy Harvey >> Beacon Falls, CT >> >> On 17 Aug 2006 06:53:50 -0700, ntuye***@yahoo.com wrote: >> >> >Hi All, >> > >> >I have a string 'ABC 12345 678910 XXXX '. I want to insert it into >> >the test.txt file using bcp command. How do I do that. >> > >> >Thanks for your help. |
|||||||||||||||||||||||