Solved

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

Posted on 2011-03-14
2
379 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
[X]
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
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

749 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