What else I can use than xp_cmdshell

352 views Asked by At

The problem I have is that we can't use the xp_cmdshell in the productive envirement. We don't have the permission for it. But what else can I use instead of xp_cmdshell for creating a file on a different server?

SELECT @path = RTRIM(sys_value) FROM system_ZZDB WHERE sys_key = 'bisKey83'
SET @cmd = 'sqlcmd -SCHW20037619 -E -dzentraleDatenbank -s "" -Q "SET NOCOUNT ON; SELECT * FROM sync_BisKey ORDER BY per_nummer" -o "'
SET @cmd = @cmd + @path + '\exportzzdb.txt" -w 1000'
exec master..xp_cmdshell @cmd

This is the code I can't use in the future. What else can i do to create files directly from de DB server? We are limited in server rights

Thank you alot.

1

There are 1 answers

0
cycoder On

You could:

  • Create a SQL Job with a Task Step having a type of PowerShell or OS CmdExec
  • Use Windows Task Scheduler and batch files