Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    Montreal, Canada
    Posts
    117

    Unanswered: BULK INSERT halt script execution

    Is there a way to continue the execution of a script after an error occured after a BULK INSERT execution?
    I tried this but is not working:

    ex:
    declare @m_strSQL nvarchar(4000)
    declare @m_RetCode int
    select @m_strSQL = N'BULK INSERT DBName.[dbo].[tableName] FROM ''c:\FileName.txt'' WITH (CODEPAGE=''ACP'')'
    execute @m_RetCode = sp_executesql @m_strSQL
    if @m_RetCode > 0
    print 'error'
    else
    print 'no error'
    Steve

  2. #2
    Join Date
    May 2002
    Posts
    299
    Take a look at MaxErrors option for bulk insert. Also, do read through Erland's article:

    http://www.sommarskog.se/error-handling-I.html
    --
    -oj
    http://www.rac4sql.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •