all groups > sql server dts > march 2007 >
You're in the

sql server dts

group:

dtutil execution results


dtutil execution results Cathryn Crane
3/21/2007 3:35:31 PM
sql server dts:
I'm trying to execute dtutil from xp_cmdshell within a SQL Script and
then populate a log table with the results. The frustration I'm having
is I only want to insert the actual result such as success or the error
message it creates. I can't get around the rows that have the Microsoft
info. Any suggestions?



Re: dtutil execution results Dan Guzman
3/22/2007 12:00:00 AM
You can get the exit code of the exec invoked with xp_cmdshell and suppress
output using this technique:

DECLARE @rc int
EXEC @rc = master..xp_cmdshell
'dtutil /SQL srcPackage /COPY DTS;destPackage /Q',
NO_OUTPUT
SELECT @rc

Regarding dtutil exit codes, the Books Online says:

<Excerpt
href="ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/sqlcmpt9/html/6c7975ff-acec-4e6e-82e5-a641e3a98afe.htm">

dtutil sets an exit code that alerts you when syntax errors are detected,
incorrect arguments are used, or invalid combinations of options are
specified. Otherwise, the utility reports "The operation completed
successfully". The following table lists the values that the dtutil utility
can set when exiting.

Value Description

0 The utility executed successfully.

1 The utility failed.

4 The utility cannot locate the requested package.

5 The utility cannot load the requested package

6 The utility cannot resolve the command line because it contains either
syntactic or semantic errors.

</Excerpt>


--
Hope this helps.

Dan Guzman
SQL Server MVP

[quoted text, click to view]
AddThis Social Bookmark Button