Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  darin strait Dec 22 '10 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. –  adrianbanks Dec 22 '10 at 18:54

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
It turned out that this was a network-related issue. –  adrianbanks Jan 4 '11 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 ;) –  TomTom Jan 5 '11 at 7:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.