I want to pass BCP commands from a SP to be executed by a powershell script.
You have a few options:
1. The easy way is to use xp_cmdshell inside your procedure (be aware of a security risk )
2.Create SQL server job with Powershell step and run the job fro your procedure
3.Build a SSIS package with Process Task run the package from your procedure
Thanks for your contribution!
In a SQL agent job, T-SQL step that processes a stored procedure. From that SP do I execute a Powershell script as:
set @CmdPowershell ='Powershell -file '+char(34)+'\\SRVqwert\SWIDEN\PS_script.ps1'+char(34)
EXEC @rc =MASTER..xp_cmdshell @CmdPowershell
if @rc != 0
I have issues with error "must be digitally sign". I don´t know how to go further.
xp_cmdshell is used just to reach Powershell. Any way to avoid xp_cmdshell? How much security risk is xp_cmdshell?, impossible question but..
19 People are following this question.
I have a report which will pull the data from this stored procedure.But dropdownlist in the report is showing NULL in the middle of other datas(Alphabetical order).I want NULL as first value in the drop downlist(so that easy for selecting)