Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Export/import text file from sql

Author  Topic 

carlossiwaily
Starting Member

24 Posts

Posted - 2004-08-01 : 08:09:47
Hi all sql experts

I would highly appreciated if anyone helping out with following tasks

1: need a stored procedure to get records from X table then generate a comma delimited text file. Than FTP the file to a directory on remote server.

2. need a stored procedure to FTP a file from remote server to local machine then use the file to add records to table X.

3. Need to run the stored procedures every 10 minutes

I really need your help



carlossiwaily

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-08-01 : 09:22:34
Are you familiar with creating and scheduling jobs in SQL Server? If yes, good. If no, open the SQL Server help manual, a.k.a Books Online, and look up the section on jobs, lots of helpful info in there. Basically, you can schedule a job to execute periodically, 10 minutes in your case. To get data into the csv file, I suggest you use something like bcp - a command line utility for extracting data from SQL Server, its efficient and quick. To FTP the files, you can use the stored procs on Nigel Rivett's excellent site: http://www.nigelrivett.net/s_ftp_PutFile.html . On the other end, you can similarly use bcp to pick up the latest file and insert the records into the database. You can also use the BULK INSERT command to insert data from a file, it can be used from within TSQL, so you can run it inside a stored procedure and you dont have to mess around with command line parameters.

There are plenty more things to think about in the process, but this is just an overview of how one might go about doing something like this.

OS
Go to Top of Page

carlossiwaily
Starting Member

24 Posts

Posted - 2004-08-01 : 14:57:15
thanks, I will try to work it out, if you have any work example it would help me out alot.

cheers m8

carlossiwaily
Go to Top of Page
   

- Advertisement -