Solved

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

Posted on 2011-03-14
2
363 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
The viewer will learn how to dynamically set the form action using jQuery.

744 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

11 Experts available now in Live!

Get 1:1 Help Now