Hi
I'm trying to export data from a stored procedure. I am attempting to call an SP to do my select and throw the result set to a DOS ascii file.
Now, my bcp command is built dynamically looks like this:
Problem is: No file output whatsoever, despite getting the DOS info back into the grid:
I have SELECTed the above command string and pasted into a DOS box and it works fine - producing output and error files. But I cannot see why it will not work from xp_cmdshell.
Incidentally
produces no junk.txt file either!
I guess its a write permissions thing ?? Anyone got any ideas?
Also I'm executing master..xp_cmdshell from the sa because it will not execute from the intended user account. How do I change the privs for execution - as xps are not listed in the Permissions Tab in the User Properties window...?? ------
Dublin, Ireland.
I'm trying to export data from a stored procedure. I am attempting to call an SP to do my select and throw the result set to a DOS ascii file.
Now, my bcp command is built dynamically looks like this:
Code:
bcp "EXEC server.db.dbo.sp_cms_output_client_data" queryout "C:\JUNK.txt" -c -r \n -t -U<USER> -P<PASSWORD> -S<SERVER> -m0 -E >> C:\JUNK.log -oC:\JUNK.out
Code:
Starting copy...
NULL
2 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 1
NULL
I have SELECTed the above command string and pasted into a DOS box and it works fine - producing output and error files. But I cannot see why it will not work from xp_cmdshell.
Incidentally
Code:
exec master..xp_cmdshell 'dir > junk.txt'
I guess its a write permissions thing ?? Anyone got any ideas?
Also I'm executing master..xp_cmdshell from the sa because it will not execute from the intended user account. How do I change the privs for execution - as xps are not listed in the Permissions Tab in the User Properties window...?? ------
Dublin, Ireland.