Is it possible to call the DBREMOTE or an external batch file from within the Database (say inside a procedure for example)?

asked 20 Mar, 04:19

Sarkis's gravatar image

Sarkis
300192236
accept rate: 0%

Could you be more explicit about what you're trying to achieve?

(20 Mar, 04:26) Reimer Pods

You can use xp_cmdshell system procedure.

(20 Mar, 06:17) Chris Keating

If so, I would recommend to use an event to run DBREMOTE, because that would run within its own connection, whereas a procedure would be waiting until DBREMOTE has finished its run...

(20 Mar, 06:47) Volker Barth
Replies hidden
1

> a procedure would be waiting

You can also fire-and-forget with the Windows START command...

BEGIN
DECLARE @return_code INTEGER;
@return_code = CALL dbo.xp_cmdshell ( 'START "title" /B "command or program"', 'no_output' );
SELECT @return_code;
END;
(20 Mar, 08:25) Breck Carter
Be the first one to answer this question!
toggle preview

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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×49
×28

question asked: 20 Mar, 04:19

question was seen: 117 times

last updated: 20 Mar, 08:25