Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Suppressing output from a stored procedure. Expand / Collapse
Author
Message
Posted Monday, April 29, 2013 12:56 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: 2 days ago @ 1:53 PM
Points: 35,366, Visits: 31,905
opc.three (4/26/2013)
A proper solution would be to get rid of the use of xp_cmdshell all together.

The recommended way using either a SQL Agent job or a web service that invokes the package. Both are decoupled from the caller, which is how it should be:

Loading and Running a Remote Package Programmatically


Heh... so far as I'm concerned, the "proper" way would be to get rid of the SSIS package and do it in TSQL. No call to anything required for that.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1447716
Posted Monday, April 29, 2013 1:43 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:16 PM
Points: 7,126, Visits: 12,726
Jeff Moden (4/29/2013)
opc.three (4/26/2013)
A proper solution would be to get rid of the use of xp_cmdshell all together.

The recommended way using either a SQL Agent job or a web service that invokes the package. Both are decoupled from the caller, which is how it should be:

Loading and Running a Remote Package Programmatically


Heh... so far as I'm concerned, the "proper" way would be to get rid of the SSIS package and do it in TSQL. No call to anything required for that.

I guess so, unless you consider xp_cmdshell nothing. No free lunch Jeff.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1447742
Posted Monday, April 29, 2013 1:48 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:16 PM
Points: 7,126, Visits: 12,726
Just for fun, how would you rewrite the SSIS package using only T-SQL to "generate a couple of excel spreadsheets, and email them."?

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1447745
Posted Wednesday, November 13, 2013 9:46 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 2:56 PM
Points: 381, Visits: 192
badOedipus (4/26/2013)
I'm posting on this old post mainly for completeness and to help anyone else out that has this same issue.

I'm not sure how far back this goes, but I know it works in SQL Server 2008 r2.
the xp_cmdshell command has an optional parameter to specify no output. In your example here your sp would have a line like this:

exec xp_cmdshell @cmd, no_ouput

BadOed


Thank you so much for this info, was banging my head up against this problem.

However, for completeness again, there is a typo in the above line, should be "no_output".

For whoever this might help, this helped solve the issue I had when trying to run an ssrs report that called a stored procedure which initially called a ssis package, then built up a dataset. Without the no_output parameter, the ssrs report was trying to work against the "output" results information from the ssis package.

Again, THANK YOU so much.
Post #1514140
Posted Thursday, November 14, 2013 6:32 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:16 PM
Points: 7,126, Visits: 12,726
TaylorMade (11/13/2013)
badOedipus (4/26/2013)
I'm posting on this old post mainly for completeness and to help anyone else out that has this same issue.

I'm not sure how far back this goes, but I know it works in SQL Server 2008 r2.
the xp_cmdshell command has an optional parameter to specify no output. In your example here your sp would have a line like this:

exec xp_cmdshell @cmd, no_ouput

BadOed


Thank you so much for this info, was banging my head up against this problem.

However, for completeness again, there is a typo in the above line, should be "no_output".

For whoever this might help, this helped solve the issue I had when trying to run an ssrs report that called a stored procedure which initially called a ssis package, then built up a dataset. Without the no_output parameter, the ssrs report was trying to work against the "output" results information from the ssis package.

Again, THANK YOU so much.

How creative. May I ask you a question about your solution? How is the SSRS data source setup? I am curious to know how the principal running the report, whether it be the user running the report or some service account (SQL or Windows), is granted access to run xp_cmdshell. You could have left yourself exposed in terms of who can run xp_cmdshell.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1514247
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse