BCP Error : A valid table name is required for in, out, or format options.

  • Hi,

    I wanted to do insert data from file into table without SSIS using select query instead of table, as I am calling udf for certain columns to do some logic in select query. But when I use BCP command, I get error of A valid table name is required for in, out, or format options. Please advise

  • Samit Shah - Saturday, February 3, 2018 7:29 PM

    Hi,

    I wanted to do insert data from file into table without SSIS using select query instead of table, as I am calling udf for certain columns to do some logic in select query. But when I use BCP command, I get error of A valid table name is required for in, out, or format options. Please advise

    Really doesn't appear appropriate to use select or a udf for an import to a table from a file using bcp. To start off with, you could post your bcp command line, the table definition, and a few sample lines of data that doesn't have any private data in it.

    Think of posting here as a "tech support" service call, give folks something so that they can do the exact thing you are doing and get the exact same error. Especially with bcp as its so darn picky LOL

  • Samit Shah - Saturday, February 3, 2018 7:29 PM

    Hi,

    I wanted to do insert data from file into table without SSIS using select query instead of table, as I am calling udf for certain columns to do some logic in select query. But when I use BCP command, I get error of A valid table name is required for in, out, or format options. Please advise

    Could you please check for any missing brackets? Otherwise if you could provide me your syntax we can look to correct

  • bcp select * from [WINKRRT-XIR\\SQLEXPRESS].[Db].[dbo].[TableName] out "C://DUst/EmployeeData.dat" -S WINKRRT-XIR\\SQLEXPRESS -U sa-P ''*********' -T

     

    Error:Copy direction must be either 'in', 'out' or 'format'.

     

  • In Linux Unable to Do bulk Insert getting  No such File or Directory Found

    Following Below steps :

    System.Diagnostics.Process proc = new System.Diagnostics.Process();

    proc.StartInfo.FileName = fileName;

    proc.StartInfo.Arguments = arguments;

    _logger.LogInformation("Before Start:");

    proc.Start();

    _logger.LogInformation("End Start:");

    proc.WaitForExit();

    }

    Input:

    bcp TableInsertTemp in /home/test.dat -S ServerIP -f /home/tracktest.fmt -U sa -P ********* -b 10000 -m 20000000 -C ACP -h CHECK_CONSTRAINTS -h FIRE_TRIGGERS

    Getting :No such file or directory

    Wasted 7 days time on this please  do help  to resolve this error

     

  • I'm surprised that you're using "/home/filename", its usually "/home/someparticularlogin/filename", did you really put the file in the directory "/home"?

     

  • Can you try again except with double quotes around the query? for example:

     

    bcp "select * from [WINKRRT-XIR\\SQLEXPRESS].[Db].[dbo].[TableName]" out "C://DUst/EmployeeData.dat" -S WINKRRT-XIR\\SQLEXPRESS -U sa-P ''*********' -T

     

    I am almost certain bcp is too small a program to contain an entire parser for the sql language 🙂

     

  • x wrote:

    Can you try again except with double quotes around the query? for example:

    bcp "select * from [WINKRRT-XIR\\SQLEXPRESS].[Db].[dbo].[TableName]" out "C://DUst/EmployeeData.dat" -S WINKRRT-XIR\\SQLEXPRESS -U sa-P ''*********' -T

    I am almost certain bcp is too small a program to contain an entire parser for the sql language 🙂

    I forgot to mention, it might be the case that you can either use the -U and -P options OR the -T option BUT NOT BOTH.

    I could be wrong, I often am lol

     

  • Please help out i need to resolve this asap...

  • I pasted my files in /home/Mydiectory/InputFiles/

  • x wrote:

    Can you try again except with double quotes around the query? for example:

    bcp "select * from [WINKRRT-XIR\\SQLEXPRESS].[Db].[dbo].[TableName]" out "C://DUst/EmployeeData.dat" -S WINKRRT-XIR\\SQLEXPRESS -U sa-P ''*********' -T

    I am almost certain bcp is too small a program to contain an entire parser for the sql language 🙂

    I noticed another issue, your password opens with doublequotes but closes with single quote. Also, if you are set on using usernames and password, you need to put a space after the username.

    I feel similar to you when trying to get BCP command to work but there are few shortcuts that allow you to avoid the detail involved in getting this command to work. One shortcut that I use is to find working examples on the web, but obviously don't just copy and paste stuff you don't understand. Use the working examples as a guide to build up the command line that suites your needs.

    Good luck!

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply