Export Stored procedure data into excel file dynamically. I need to schedule it for every monday. It has to create a new file every time it runs. I have tried below code but its givingme error.
declare @sql varchar(8000)
select @sql = 'bcp "EXECUTE MARKETING_MONDAY"
queryout c:\bcp\sysobjects.txt -c -t, -T -S'
exec master..xp_cmdshell @sql
Any help is appreciated.