4

We are experiencing a bizarre error with our application at a customer site. We have managed to narrow it down to the point where we can replicate the behaviour using just Management Studio and SQL Server.

We have two machines, A and B:

 +------------+ +--------------------+ | [A] | | [B] | | Management | --------------> | SQL Server 2008 R2 | | Studio | | Enterprise x64 | +------------+ +--------------------+ 

We are running a SQL script in Management Studio on machine A against the SQL Server instance on machine B. We are not actually executing the script, just parsing it.

Most of the time, the parse operation works fine. Occasionally (seemingly randomly), the parse operation fails with a syntax error. The error message shows the part of the script with the error, which appears as some SQL from the original script that has been truncated and has random characters appended to it.

An example:

The original SQL:

SELECT DISTINCT ST.TABLE_NAME as TableName FROM INFORMATION_SCHEMA.TABLES AS ST INNER JOIN INFORMATION_SCHEMA.COLUMNS AS SC ON SC.TABLE_NAME = ST.TABLE_NAME WHERE ST.TABLE_TYPE = 'BASE TABLE' AND SC.COLUMN_NAME = 'Identity' AND ST.TABLE_NAME != 'dtproperties' ORDER BY ST.TABLE_NAME 

The SQL that is in error (as reported by SQL Server):

SELECT DISTINCT ST.TABLE_NAME as TableName FROM INFORMATION_SCHEMA.TABLES AS ST INNER JOIN INFORMATION_SCHEMA.COLUMNS AS SC ON SC.TABLE_NAME = Sā怊 

The above example shows how the query is being corrupted. It doesn't always happen, and is not always the same bit of SQL that causes the error. Parsing this script against another SQL Server instance produces no errors, showing that the script is fine.

It appears that something is corrupting the SQL that is being received the the server. This leads me to think that the problem lies either with the client end or in the transmission of the SQL from the client to the server. I have a SQL trace from the period where an error occurs, which shows the SQL has been corrupted when SQL Server receives it.

We have been unable to track down any possible cause of this behaviour, and so cannot find a fix. Because the errors occur seemingly randomly, it is also very hard to generate reproduction steps to submit a bug report.

Any ideas?

2
  • Old versions of SQL Litespeed used to sniff queries coming into the server and rewrite them if certain conditions were met. Are they running an old version of Litespeed? Also, does the string get corrupted at the same spot each time (at some particular character offset from the start of the query?). Does the server have ECC memory? If there was a memory problem that was that bad, I would expect the server to blue screen but I would run some diagnostics on it if I could. Commented Dec 22, 2010 at 13:36
  • @bitplayer: They are not running SQL Litespeed. The string gets corrupted at random positions - usually a completely different line and character number. Commented Dec 22, 2010 at 18:54

1 Answer 1

3

Pull out SQL Server. Time for a thourough system check. Memory (of the compuer but possibly also the network card) cuold be the culprit. I would expect to see memory errors appearing.

2
  • It turned out that this was a network-related issue. Commented Jan 4, 2011 at 15:01
  • Great ;) This is one of the erros looking really bad but then it is soooo bad it can not be with the program otherwise it would have popped up a long time ago ;) Commented Jan 5, 2011 at 7:05

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.