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 '18, 04:19

Baron's gravatar image

Baron
2.0k128141170
accept rate: 48%

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

(20 Mar '18, 04:26) Reimer Pods

You can use xp_cmdshell system procedure.

(20 Mar '18, 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 '18, 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 '18, 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:

×77
×34

question asked: 20 Mar '18, 04:19

question was seen: 966 times

last updated: 20 Mar '18, 08:25