Wednesday, December 17, 2008

An error occurred while executing batch. Error message is: Invalid calling sequence: file stream must be initialized first.

SQL Server will throw below error message when you try to format T-SQL Query Analyser output to XML or HTML or any other format and then try sending mail with body with prepared HTML or XML...

Error Message:
An error occurred while executing batch. Error message is: Invalid calling sequence: file stream must be initialized first.

Root Cause:
McAfee On Access Scanner is blocking the .tmp file created by SQL Server before sending file stream to SMTP Server.

Solution:
Exclude sqlwb.exe (Management Studio) or SQLSERVER.EXE or isqlw.exe from where you are facing this error in the On-Access Scanner list using exception list option available!

I faced this issue today when try to send mail from Management Studio for one alert application!

2 comments:

Mohsin Farooq said...
This comment has been removed by the author.
Mohsin Farooq said...

i am having this error on simple sql query page. i just wrote select * from tbl . table have 2 columns id int primary key identity(1,1), name varchar. how to resolve this issue?

Post a Comment

Please do not spam!