Click here to Skip to main content
13,350,486 members (48,578 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello All
I Want to Export Sql Table To text file
I do that by
exec master..xp_cmdshell 'bcp "Select * FRom Db..Table as t" queryout "C:\AA.txt" -c -T -SServer_Name '
It do fine but it export result to server
I want to export this result to myPc not at server
Any Help Please.
Posted 31-Mar-13 22:13pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can create a powershell script as your requirement and execute it. It will store your sqlserver data to your local or any share location. Just you take a basic idea about powershell if you have not. Then go the following site:[^]
It will show you a sample powershell script that will export data from a custom query and save it to local c drive and .csv file. All those are configurable.
Mustafa Salman 1-Apr-13 6:01am
Thank you for your responce
but I want Direct Export from server to local PC
someone Suggest using UNC
but I have no idea to do that.
S. M. Ahasan Habib 1-Apr-13 6:07am
you can change in powershell connection string and run it from your local. It will fetch data from remote database server based on your connection string and store it to your local pc. You just go the link above create a powsershell script (.ps1 extention) and dump that code to your file and update with your connection string. Then go to windows powershell tool, execute that see the result. As simple as that. I think you will impress with power shell power.
Mustafa Salman 1-Apr-13 7:22am
Hello again

I followed above link
and do what he do
Now I wonder how include it at my application
Using Visual Fox Pro.
Any Help ?
S. M. Ahasan Habib 1-Apr-13 12:46pm
Sorry no idea about Visual Foxpro.
Mustafa Salman 3-Apr-13 2:20am
Thank you very much
I do that
Thank again for your helpful link.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Mustafa Salman 1-Apr-13 4:19am
No Result at your link :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 1 Apr 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100