This happen with older 1.2.2 driver as with new 1.3.0 driver (accessing SQL Server 2008 R2 database on windows 64 Bit):
A stored procedure is called which does sum SQL commands and returns a ResultSet with a finaly SELECT statement. This works flawlessly, if the final SELECT selects from a table or a table variable. But if it selects from a custom table type, it throws this exception:
TDS Protocol error: Invalid packet type 0x0, SQLSTate=08S01
The workaround is to create a (redundant) table variable in the procedure with the same columns as the table type and INSERT the rows via:
INSERT INTO @l_TableFromLocalTableVariable
SELECT * FROM @l_TableFromTableType
With this workaround the error doesn't occur. This is strange as the original source of the final select should be irrelevant - but it seems, it is not. Is this a known problem in the jTDS driver?
Of course, the workaround is ugly, as it just copies the same rows from a table type container to a table variable container.
Log in to post a comment.