I found the script on the web to bcp out multiple tables and am trying to change it so that I can export certain tables.
a) Add the -b switch when I add it, I get an error
b) Get the count of rows and insert into a log table
c) Get the tables name and file name
I keep getting the following error that I should declare variable "@tblname. Is it the exec statement thats causing this ?
Msg 1087, Level 15, State 2, Procedure prc_BcpOut, Line 49
Must declare the table variable "@tblname".
Msg 121, Level 15, State 1, Procedure prc_BcpOut, Line 51
The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns.