hi,
I am using sql server 2005,
I want create sql procedure will save data into csv file.
Below is the qurey I am trying but it is not creating any file in my system.
use PBMS_DocumationWorkflow
go
create proc s_bcpMasterSysobjects
as
select '"' + name + '"'
+ ',' + '"' + convert(varchar(8), crdate, 112) + '"'
+ ',' + '"' + convert(varchar(8), crdate, 108) + '"'
from master..sysobjects
order by crdate desc
go
declare @sql varchar(8000)
select @sql = 'bcp "exec PBMS_DocumationWorkflow..s_bcpMasterSysobjects"
out c:\bcp\sysobjects.txt -c -t, -T -S'+ @@servername
exec master..xp_cmdshell @sql
please suggest the cause or give me sample code which works fine.
Thanks.