SQLTeam.com | Weblogs | Forums

Export Stored procedure data into excel file dynamically

sql2008
sql2008r2

#1

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'

  • @@servername
    exec master..xp_cmdshell @sql

Any help is appreciated.


#2

Use SSIS