So its kind of complicated I think, I've been searching all day for a solution.
I have a SQL Server 2008 R2 and with xp_cmdshell
I currently generate some .csv
files in C:\
What I want to do now is generate them directly into a linux server in the network.
I tried this :
EXEC xp_cmdshell 'NET USE T: \\192.168.0.25\PERSONS 123456 /user:linuxuser /PERSISTENT:yes'
set @filepath = 'T:'
set @command ='echo '+@customerheader+' > '+@filepath+'\PERSONS\'+convert(varchar,123456)+'.csv'
set @command = replace(@command,'&','e')
exec master..xp_cmdshell @command
EXEC xp_cmdshell 'net use T: /delete'
And what I get is: "The system cannot find the path specified."
While the mapped drive is created succesfully: "The command completed successfully." and "T: was deleted successfully."
Thank you in advance