all groups > sql server programming > september 2004 >
You're in the

sql server programming

group:

How to access a local text file from SP on remote database.


How to access a local text file from SP on remote database. Mark Butler
9/13/2004 9:44:00 PM
sql server programming: I have a set of text files which are ftp'd to my server daily. I have to
update these to multiple remote SQL databases. I am linked to these
databases via a VPN and use the IP address to set up the link to my local
server. Each of these stored procedures build a work file from these text
files using a "BULK INSERT" statement as follows.

------------------------------------
CREATE PROCEDURE sp_county
@updates_dir varchar (500)
AS
--build the county lookup table
CREATE TABLE [dbo].[wk_file]
([wk_data] [char] (54) NULL)

DECLARE @bulk_insert varchar (500)
SET @bulk_insert='BULK INSERT wk_file FROM "'+@updates_dir+'county.seq'+'"
WITH (TABLOCK)'
EXEC (@bulk_insert)
------------------------------------

How can I point the @updates_dir at my server? It seems that I can only
access local drives to the server with the physical databases. Is there a
better way I am not seeing? Any insight would be appreciated.

TIA
Mark

RE: How to access a local text file from SP on remote database. John Bell
9/14/2004 12:33:09 AM
Hi

You may want to look at running a scheduled DTS package on each of these
servers, this may help http://www.sqldts.com/default.aspx?292

In SQL 2000 BULK INSERT will take a UNC name as the data file.

John

[quoted text, click to view]
Re: How to access a local text file from SP on remote database. hkvats_1999 NO[at]SPAM yahoo.com
9/14/2004 5:41:00 AM
Hi Mark,

You can put all text file in shared folder on your server and you can
set that shared folder path in @updates_dir variable i think it will
perfectls...

BULK INSERT wk_file FROM
'\\<yourcomptername>\<sharedfolder>\county.seq'
WITH (TABLOCK)

Regards
AddThis Social Bookmark Button