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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-09-25 : 22:11:59
|
| Colin writes "I am using the following stored proc to insert a bar delimited text file I had thought that it wasworking fine until I checked the data and found that for some reason only every other line of thetext 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)asdeclare @dynINSERT varchar(300)declare @dynDELETE varchar(300)declare @dynUPDATE varchar(300)select @dynDELETE = ' DELETE FROM '+@tablenameselect @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)" |
|
|
|
|
|