question

davecalixte avatar image
davecalixte asked

Put SQLCMD output file on a share.

I want my output file on a share and below is what I execute and get the error: "Error occured while opening or operating on file \\\myshare\folder1\filename.txt SQLCMD -S (local) -E -d somedatabase -q "EXEC usp_SomeStoredProc" -o \\myshare\folder1\filename.txt When I try to have the output on my local drive. It works fine: SQLCMD -S (local) -E -d somedatabase -q "EXEC usp_SomeStoredProc" -o C:\temp\filename.txt I do not think it is a permission issue to the share because from windows explorer I can access it. Any ideas?
sql-server-2005sqlcmd
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
Is this failure during execution of the SQLCMD as part of a scheduled script? If so, check that the account being used to run the script has access to the fileshare. Is there a space in the filename / path you're attempting to write to? If so, wrap the full output path in quotes: sqlcmd.... -o "\\myshare\folder1\filename.txt" Have you tried using the IP address of the server? By "\\\\myshare", do you mean the name of the fileshare, or the computer & fileshare? Because you'll need to specify both: sqlcmd.... -o "\\remotecomputername\sharename\folder\filename.txt"
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

davecalixte avatar image davecalixte commented ·
Thank You Sir! I tried with the IP Address instead and it works!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.