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..
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%
CREATE PROCEDURE [dbo].[SP_TMP_FLATFILE]
-- 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.
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.
Really appreciate you help on this. A bit urgent request.