Solved

cgi-bin file - can SQL import or link to remote file

Posted on 2011-03-14
2
369 Views
Last Modified: 2013-12-25
I want my local sql 2000 server to connect over the internet to our ISP where I host a website. We need it to link to/import a flat file in the sites cgi-bin into my SQL server. Is this possible and how do we do it?
0
Comment
Question by:ron69
2 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
ID: 35139097
If you have access to a SQL 2005 (or later) server, you can do this using SSIS, which has a built-in FTP task that would make getting a file from a remote FTP site pretty straightforward.

If you only have SQL 2000 (upgrade - it's unsupported!), then you can use a modified version of this walkthrough:

http://www.sqlteam.com/article/using-dts-and-ftp-to-push-files

In that example, he pushes the completed file to FTP, but you could easily modify the script to get the file instead of put it on the site - just change the "MPUT" command in the FTP script to "MGET" and it will fetch the file from the remote site and save it locally. Once that's done, you can connect to it in your package just like you'd connect to any other local flat file and import the data that way.
0
 
LVL 7

Expert Comment

by:lozzamoore
ID: 35139203
Assuming you have all the required vpn settings in place, so that the share on the website is exposed as a UNC path, you should simply be able to use something like the following:

BULK INSERT <Table_Name>
FROM '<unc path>'
WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' )

There is also the OPENROWSET statement:

http://www.databasejournal.com/features/mssql/article.php/10894_3331881_3/OpenRowSource-and-OpenRowSet-in-SQL-Server-2000.htm

Regards,

Lozzamoore
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell  and PSExec = Password failure 5 21
Get the latest status 8 29
SQL Update trigger 5 16
SQL Insert parts by customer 12 31
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…
Read about achieving the basic levels of HRIS security in the workplace.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

813 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now