BrilBroeder
BrilBroeder

Reputation: 1579

BULK INSERT data from local file to remote sql server

I want to upload some data from a local file on my pc via SQL-manager to a sql-database on azure.

I tried

BULK INSERT gifts
   FROM 'c:\temp\trouwpartij.txt'  
   WITH   
      (  
         FIELDTERMINATOR =' |',  
         ROWTERMINATOR =' |\n'  
      );  

But unfortunatly the path is pointing to a location on the sql-server, which I cannot access.

Any suggestions how to complete this simple task whitout actually developing a small application ?

Upvotes: 5

Views: 17469

Answers (2)

Alberto Morillo
Alberto Morillo

Reputation: 15658

As mentioned by Kevin, you can use bcp command line utility as shown below:

bcp AdventureWorksLTAZ2008R2.SalesLT.Customer in 
C:\Users\user\Documents\MoveDataToSQLAzure.txt -c -U username@servername -S 
tcp:servername.database.windows.net -P password

This documentation may give you more information.

Upvotes: 2

Kevin Farlee
Kevin Farlee

Reputation: 21

You can use the BCP utility to load data from a local file to a SQL instance, whether it is local, Azure SQL DB, or a SQL Server in an Azure VM.

Upvotes: 2

Related Questions