?
Solved

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

Posted on 2011-03-14
2
Medium Priority
?
383 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 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

840 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