SQL Server – Importing Local Data to Remote Server

sql serverssms

I currently have a machine A with SQL Server Management Studio (SSMS), and a data file on it.

A connects to machine B's SQL Server database. I have no control of machine B.

The problem is:

I can't transfer data using neither DB restore, DB attach, nor bulk import. Because for any query like

BULK INSERT [MY_TABLE_NAME] 
FROM 'F:\Data\MY_TABLE_NAME.txt' WITH (
FIRSTROW=2,
FORMATFILE='F:\Data\MY_TABLE_NAME.txt.fmt')


RESTORE DATABASE MY_TABLE_NAME
FROM DISK = 'F:\Data\MY_TABLE_NAME.bak'
WITH REPLACE

SQL Server Management Studio will try to open the file in B machine, not my machine A. (I can't transfer the file to machine B.)

Is there a way to open the local file in this situation? (Technically, I can use a Python script to insert table by table, row by row, but that would be way too inconvenient.)

Best Answer

Use BCP, or the SQL Server Import and Export Wizard. Both will read from local files.