Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Order by fails #4

kbrekke opened this Issue Jan 11, 2012 · 4 comments


None yet
3 participants

kbrekke commented Jan 11, 2012


Good work on this module. I'm at MS SQL Server 2005 and node.js 0.6.7. I'm experiencing trouble when attempting to do an ORDER BY;

var stmt = conn.createStatement('SELECT TOP 1 * FROM MyDb.dbo.MyTable t ORDER BY t.MyTableId');

This query works in SQL Managmenet Studio. It works without the ORDER BY clause.
I get the following error;

throw err;
Error: Unrecognized type: 169
at TokenStreamPacket._getTokenFromType (/dev/odbctest/node_modules/tds/lib/tokenstream.packet.js:63:15)
at TokenStreamPacket.nextToken (/dev/odbctest/node_modules/tds/lib/tokenstream.packet.js:71:18)
at TdsClient._handleToken (/dev/odbctest/node_modules/tds/lib/tds-client.js:197:35)
at TdsClient._handlePacket (/dev/odbctest/node_modules/tds/lib/tds-client.js:270:19)
at TdsClient. (/dev/odbctest/node_modules/tds/lib/tds-client.js:169:19)
at Socket. (/dev/odbctest/node_modules/tds/lib/tds-client.js:2:59)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:347:14)


cretz commented Jan 11, 2012

I'm an idiot, I didn't implement this token yet: http://msdn.microsoft.com/en-us/library/dd303317%28v=PROT.13%29.aspx. I will get to it shortly.

@ghost ghost assigned cretz Jan 11, 2012

@cretz cretz closed this in 8fcaf35 Jan 12, 2012

@cretz cretz reopened this Mar 16, 2012


cretz commented Mar 16, 2012

(reopening so that it will become obvious when this is released on npm)

ekryski commented Mar 17, 2012

Hey man. Do you wanna push this to npm? I have the same issue and if you have actually fixed it that would be suweet! Thanks for the effort by the way. It's really appreciated.


cretz commented Mar 20, 2012

I need to fix a couple more basic issues before I publish, sorry. But the code can be checked out and used easily as is from master. I commit the compiled JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment