Hi,

I know this isn't really the ideal place to post this, but we've been trying
to resolve this one for 2 weeks now, and no one else seams to be able to
help!!

I am using the following stored proc to insert a bar delimited text file
into an SQL 7 database.

I had thought that it was working fine until I checked the data and found
that for some reason only every other line of the text file is inserted.

Does anyone have any ideas as to why that might be ?


CREATE PROCEDURE importcsv
@user_site_id varchar(100),
@filename varchar(255),
@tablename varchar(25),
@template varchar(255)
as
declare @dynINSERT varchar(300)
declare @dynDELETE varchar(300)
declare @dynUPDATE varchar(300)
select @dynDELETE = ' DELETE FROM '+@tablename
select @dynINSERT = ' BULK INSERT '+@tablename+'
   FROM '''+@filename+'''
   WITH(TABLOCK , KEEPNULLS , FIELDTERMINATOR = ''|'' , ROWTERMINATOR =
''\n'' , FIRSTROW=2,
FORMATFILE='''+@template +''' )'
select @dynUPDATE = ' UPDATE '+@tablename+'
   SET call_site_id = '''+@user_site_id+'''
   WHERE call_site_id = ''unknown'''
exec(@dynDELETE)
exec(@dynINSERT)
exec(@dynUPDATE)

Marc Gadsdon
http://www.in-tuition.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with 
'unsubscribe' in the body or visit the list page at www.houseoffusion.com

Reply via email to