Author |
Topic |
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-01-10 : 11:29:40
|
All,Can anyone please let me know how we can bcp out of 10 tables at a time. Currently i am doing one at a time using the below command in cmd prompt...bcp databaseName..tableName out "c:\tableName.txt" -c -T -S SERVERNAMEi am not sure how i can write the whole 10 bcp outs in a text file and execute it. Can someone let me know how to do this? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-10 : 11:32:58
|
you mean append the same file with result merged from ten identical structured tables?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-01-10 : 11:50:18
|
Thanks for the prompt response.what i want is i have 10 different tables and i want extract them using bcp. I am able to do for one table in cmd prompt. But what do i need to do to extract all of them at a time? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-10 : 11:51:48
|
sorry still not completely clearextract all 10 tables data to single file? also are they of same structure?or extract them to 10 different files at same time?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-01-10 : 11:57:39
|
sorry..i want them to extract them to 10 diff files at a time. their structure is completely different. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-10 : 11:59:33
|
why dont you wrap all of them inside a stored proc and then call it to do all of them at once?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-01-10 : 12:02:50
|
i want to do this using command prompt...i cannot use xp_cmdshell. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-10 : 12:10:03
|
create a batch file containing all the bcps and then execute the batch file from command prompt------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-01-10 : 12:26:53
|
yeah..but i am not so familiar with batch file and how it works. Could you please let me know how it works? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|