x

How do you make BCP not to display output?

I have a query that uses BCP to output results to a file. I would like to supress the results of the BCP and replace them with my own custom message. i.e I would like to replace:

NULL
Starting copy...
1000 rows successfully bulk-copied to host-file. Total received: 1000
1000 rows successfully bulk-copied to host-file. Total received: 2000
NULL
2000 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1719   Average : (132329.84 rows per sec.)
NULL

with

'Query executed successfully'
Thanks
more ▼

asked Dec 09 '09 at 01:25 PM in Default

benson gravatar image

benson
26 2 2 2

(comments are locked)
10|1200 characters needed characters left

5 answers: sort voted first

Sorry, the user running the script simply has to click on the 'Messages' tab to get my comments. I need a nap!

more ▼

answered Dec 09 '09 at 01:34 PM

benson gravatar image

benson
26 2 2 2

Can you mark your question as answered?
Dec 10 '09 at 07:00 AM Mark Allison
(comments are locked)
10|1200 characters needed characters left

Assuming you are using xp_cmdshell to invoke BCP, then you can suppress the results from being displayed by including the no_output option.

There is information about it at: http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx

more ▼

answered Dec 11 '09 at 05:36 PM

TimothyAWiseman gravatar image

TimothyAWiseman
15.5k 19 22 32

(comments are locked)
10|1200 characters needed characters left

alt text

bcp.jpg (16.1 kB)
more ▼

answered Aug 09 '12 at 05:42 AM

ramesh 1 gravatar image

ramesh 1
2.1k 59 67 69

(comments are locked)
10|1200 characters needed characters left
hi
more ▼

answered Mar 11 at 08:19 AM

jallo gravatar image

jallo
1

(comments are locked)
10|1200 characters needed characters left
hello i need help
more ▼

answered Mar 11 at 08:21 AM

jallo gravatar image

jallo
1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x977
x38

asked: Dec 09 '09 at 01:25 PM

Seen: 4109 times

Last Updated: Mar 11 at 08:21 AM