Bcp 2000 - Function sequence error

  • Hi,

    I am facing the error while calling the below sp from windows batch job using bcp command as below. I am using BCP utility of SQL 2000.

    This batch job is working fine till now and suddenly it start giving this issue and I re run the job and it went fine.

    Any help on this. Why it is occurring randomly..

    Error:

    SQLState = S1010, NativeError = 0

    Error = [Microsoft][ODBC SQL Server Driver]Function sequence error

    Code in Batch Job:

    SET QUERY="set fmtonly off exec %LMDatabase%.dbo.SP_TMP_FLATFILE"

    %bcp% %QUERY% queryout %NDMPATH%\%File% -c -r -e%ErrorFile% -S%Server% -U%Username% -P%Password%

    Stored Procedure

    CREATE PROCEDURE [dbo].[SP_TMP_FLATFILE]

    AS

    BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Insert statements for procedure here

    SELECT * into #TMP_FLATFILE from TMP_FLATFILE

    SELECT * FROM #TMP_FLATFILE --This table contains only one column with length of 2000 char.

    END

    Also observed one major thing if #TMP_FLATFILE contains data as below then I am getting error and if it cotains simple data like 'ABCDEFFG' then no error and job went fine.

    10~01~APLEGAL~APLEGAL_HKHKD_LEGALHK-FCY_20150730_114300_INV_FLAT.TXT~16670~49~20150730:114300~~~

    Really appreciate you help on this. A bit urgent request.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply