• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

BCP from Unix box to NT SQL Server box.

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.
0
arichee
Asked:
arichee
  • 3
  • 2
1 Solution
 
simonsabinCommented:
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




0
 
aricheeAuthor Commented:
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.
0
 
simonsabinCommented:
If you can map a drive in NT to you unix box then you can reference the file that way.
0
 
simonsabinCommented:
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
0
 
aricheeAuthor Commented:
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now