BCP Command format

BCP Command format

Post by Jack » Wed, 13 Aug 2003 07:22:02


Hi, I am writing Stored procedures to give me an output
String then I could write the string to an output file. I
am using the BCP utility to write the string to an output
file. Any help would be greately appreciated.
Here is the script.

Declare @vSqlStr varchar(4000),@vTableCode varchar
(1000),@iReportId int

SET @iReportID= 1
SET @vTableCode='LTI_S'

set @vSqlStr= 'SELECT table_code from table_values WHERE
report_id ='+convert(varchar,@iReportId)+' and
table_Parameter.table_code ='+@vTableCode
print @vSqlStr
EXEC master..xp_cmdshell out "@vSqlStr", -
oc:\Mydocument\InsDel.sql

Thanks
Jack
 
 
 

1. Formatting Number In Accounting Format - BCP

2. bcp & trigger: got missiing data in bcp out files

I have a trigger 'trgTblUpdate' working on the table 'Tbl'. When the
table 'Tbl' got inserted/updated data, the tigger is fired and then we
use a batch file with bcp command to unload those new inserted/updated
data to another server. But in bcp out file, it didn't get all new
inserted/updated data, there are some missing data. I am not sure if I
explain it clearly. Could you help me out of this problem???? I am
stuggling for that these two days............Any help is appreciated.

1. code for trigger:

CREATE TABLE [TblUpdate] (
[id] [int] NOT NULL ,
[eventid] [int] NOT NULL ,
[sequenceid] [int] NOT NULL ,
[UpdatePass] [int] NULL
) ON [PRIMARY]
GO
create trigger trgTblUpdate on Tbl For Insert,Update as
insert into TblUpdate(id,eventid,sequenceid) select ins.id,
ins.eventid,ins.sequenceid from inserted ins

2. bcp code in the Batch file:
isql -U <user> -P <pw> -S <server> -Q "update AA..TblUpdate set
UpdatePass=1 where UpdatePass is null"

bcp "select a.* from AA..Tbl a, AA..TblUpdate b where
a.eventid=b.eventid and a.sequenceid=b.sequenceid and b.eventid<>-1
and b.sequenceid<>-1 and b.updatepass=1" queryout 30sec-%TFN_NOW%.wrk -
U <user> -P <pw> -S <server> -f Tbl.fmt

isql -U <user> -P <pw> -S <server> -Q "delete from AA..TblUpdate where
UpdatePass=1"

3. bcp and trigger: missing data in bcp out file

4. bcp - Unable to open BCP host data-file

5. odbc bcp api vs BCP utility

6. Unexpected eof encountered in bcp data file...msmerge_genhistory90.bcp

7. bcp vs. dts, native sql bcp, text etc.??

8. how to catch and handle errors in bcp or programme calling BCP?

9. bcp out and bcp in don't give the same number of rows

10. Determining When a DOS Command is Finished In Access - BCP

11. how to use bcp command to output stored procedure result

12. Will bcp out command or auto-shrink create lots of tran-log in the database?

13. Login failed when I execute a job with the command BCP out

14. BCP for passing $password to a command-line Perl script?

15. How to use BCP command to insert the result from query into the existing FOXPro DBF?