BCP from Unix box to NT SQL Server box.

Posted on 1999-08-02
Medium Priority
Last Modified: 2010-05-18
Is there a Unix version of bcp.exe?  I'd like to bulk copy a flat file from a Unix box into a SQL Server table residing on an NT box.
Question by:arichee
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

simonsabin earned 200 total points
ID: 1096999
I Presume as sql server does not run on Unix you have a data file that you want to load into your sql serve database on the NT  box.

The easiest way is to create a delimited text file which can be then used by BCP. If you use an obscure delimiter  then you will have less problems say  a "~".

You can then transfer (ftp) the file to the nt machine and do the BCP. The following will BCP a file name MyTable.DAT into a table called my table and a database called MyDatabase and server MyServer using sa with no password. With a column delimiter of ~ and record delimiter of carriage return

BCP MyDatabase..MyTable IN MyTable.Dat /SMyServer /Usa /P /t~ /r\n

You will have to make sure that when you transfer it you have the text in windows text otherwise you might have a problem with the carriage return.

Have a go any problems let me know


Author Comment

ID: 1097000
That's what I'm doing now, FTPing it from my Unix box to the NT box and BCPing it.  I'd like to eliminate the FTP step and simply BCP it directly.

Expert Comment

ID: 1097001
If you can map a drive in NT to you unix box then you can reference the file that way.

Expert Comment

ID: 1097002
ps For your information. If you still have questions about an answer you should post these as comments. once you are satisfied that the answer is correct and what you want you should accept it, or reject it is not. This means you can then give nice A and B grades rather than C or D(Which most experts don't enjoy receiving).

On your question you could implement the ftp and BCP in one DOS batch program

Author Comment

ID: 1097003
That's not really possible in my environment.  It's kind of frustrating that there is apparently no way to directly access a SQL Server database from Unix.

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question