eseeweb (4/30/2014)
hiI just have an update that we don't need to delete the record from the table as long as every time a record inserted can be write to a text file for the other side to consume. So, i did a quick test like this and have access denied issue.
exec master.xp_cmdshell 'echo hello > c:\file.txt' which try to write to the c drive on the sql server.
but if i quality it as
exec master.xp_cmdshell 'echo hello > \\myPC\c$\file.txt'
The issue is when i log on to sql server, i can add/write/mod files from c drive. Any reason? How to i use "execute as" statement?
thx, Ted.
SQL Server needs to have the privs to write to whatever UNC you're using. I STRONGLY recommend that you NEVER have SQL Server writing to UNCs that are desktop servers. I can see it writing to company shares on a dedicated share box but not to desktop PCs.
--Jeff Moden
Change is inevitable... Change for the better is not.