| Author |
Topic |
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-10 : 14:47:18
|
| Hi,I have a SP on a SQL box, which currently outputs the result into a file and saves it on the local drive. If i want to save it on a shared network drive, can i do it and how?I am currently logged in with admin account into the sql box, i want to save the output on a drive on a different machine,which i have mapped as a network drive in the SQL box.Please advise.Padhma |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 15:13:05
|
I would try and see what happens... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-10 : 15:22:01
|
| Hi webfred,I tried.This is my code:'bcp out "\\servername\F:\Data\test.txt" -c -t, -T'This is the error:SQLState = HY000, NativeError = 0Error = [Microsoft][SQL Native Client]Unable to open BCP host data-filePadhma |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 15:36:00
|
If you have mapped to drive f: there is no need (no it is a mistake) to give the servername.If drive f: on local box is mapped to \\servername\data\ then just use F: No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-10 : 15:47:09
|
| I have tried that as well. Same error.here F:\ corresponds to the local drive on the remote server "servername" and Data is a folder under the F:On my server SQL , i have Z:\ which opens up the shared drive at \\servername\F:\ I have tried using 'bcp out "Z:\Data\test.txt" -c -t, -T'same error.Padhma |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 16:00:32
|
The shared folder or drive must have a name - not F: No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-10 : 16:08:33
|
| Yes,there is, I have tried that.\\servername\sharename\foldername\test.txthave also tried z:\foldername\test.txtMapped drive z:\ --> \\servername\sharenameSame error. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 16:14:36
|
Sorry then I don't know but maybe there is no right configured to point to a network drive.Sorry padhmaWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-09-10 : 17:38:08
|
quote: I tried.This is my code:'bcp out "\\servername\F:\Data\test.txt" -c -t, -T'
You are missing the table name in the BCP statement.Try this:bcp "master.dbo.sysdatabases" out "\\servername\Data\test.txt" -c -t, -TDo you still get an error?The mapped drive option is dependent on the user account, and seldom works with service accounts (which don't have the same drive mappings) |
 |
|
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-11 : 08:56:35
|
| Yes. I still get the same error. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-11 : 09:46:09
|
| bcp "master.dbo.sysdatabases" out "\\servername\F$\Data\test.txt" -c -t, -TMadhivananFailing to plan is Planning to fail |
 |
|
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-11 : 10:06:32
|
| Same error. |
 |
|
|
padhma.p
Yak Posting Veteran
91 Posts |
Posted - 2009-09-11 : 10:21:16
|
| Madhi and webfred, I am not sure why I keep getting the same error though I have full access on both the machines. Alternatively, I am copying to another machine via:xcopy command using a bacth file. Thank you. |
 |
|
|
|