[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Copy command not working to create "txt" file from two "csv" files

Posted on 2013-10-24
3
Medium Priority
?
447 Views
Last Modified: 2013-10-25
Working Code:

bcp "select * from livedb.dbo.tblRCASelfPay" queryout "P:\ACCOUNTING\RCA.csv" -T -SPTM-DR01 -w -t^,
bcp "select * from livedb.dbo.tblRCAHdr" queryout "P:\ACCOUNTING\RCAHdr.csv" -T -SPTM-DR01 -w -t^,
copy P:\ACCOUNTING\RCAHdr.csv + P:\ACCOUNTING\RCA.csv P:\Accounting\RCAData.txt


Non-Working Code:

bcp "select * from livedb.dbo.tblRCASelfPay" queryout "P:\RCA-Self Pay\SP_Data\RCA.csv" -T -SPTM-DR01 -w -t^,
bcp "select * from livedb.dbo.tblRCAHdr" queryout "P:\RCA-Self Pay\SP_Data\RCAHdr.csv" -T -SPTM-DR01 -w -t^,

copy P:\RCA-Self Pay\SP_Data\RCAHdr.csv + P:\RCA-Self Pay\SP_Data\RCA.csv P:\RCA-Self Pay\SP_Data\RCAData.txt


The above BCP statements and Copy command are being used to combine two SQL tables into a "txt" file.

For both BCP statements the creation of the "csv" files work in both paths.  However, the COPY command does not work for the second group of statements.  The only difference I see is the PATH.

I am hoping another set of eyes can see a problem with the second COPY command.

Thanks

Glen
0
Comment
Question by:GPSPOW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Giovanni Heward earned 2000 total points
ID: 39599128
I'd place the paths in quotes, as there appears to be spaces.

copy "P:\RCA-Self Pay\SP_Data\RCAHdr.csv"+"P:\RCA-Self Pay\SP_Data\RCA.csv" "P:\RCA-Self Pay\SP_Data\RCAData.txt"

Open in new window

0
 

Author Closing Comment

by:GPSPOW
ID: 39599136
Thanks

That did it.

glen
0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39600731
Your welcome, here's a bonus:

setlocal enabledelayedexpansion
set p=P:\RCA-Self Pay\SP_Data
bcp "select * from livedb.dbo.tblRCASelfPay" queryout "!p!\RCA.csv" -T -SPTM-DR01 -w -t^,
bcp "select * from livedb.dbo.tblRCAHdr" queryout "!p!\RCAHdr.csv" -T -SPTM-DR01 -w -t^,

copy "!p!\RCAHdr.csv"+"!p!\RCA.csv" "!p!\RCAData.txt"

Open in new window

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question