TOP-clause generated wrong for SQL Server 2000 in V4.0

Posts   
 
    
Ruudster
User
Posts: 33
Joined: 13-Apr-2005
# Posted on: 01-Aug-2013 13:13:09   

I'm upgrading from v2.6 to v4.0 and see, that the runtime queries generated for SQL Server 2000 (v8.0.2039 = SQL 2000) with a 'TOP'-clause are wrong. The transact-sql syntax is 'SELECT DISTINCT TOP x' and not 'SELECT DISTINCT TOP(x)', as is generated (this is the syntax for SQL 2005 and up ) by LLBLGen.

As a result, i'm getting "Incorrect syntax near '('. " at runtime.

Ruudster
User
Posts: 33
Joined: 13-Apr-2005
# Posted on: 01-Aug-2013 13:16:29   

Extra info:

i'm using LLBLGen V4.0 June 18th, 2013 version.

I've also just installed a debug-dll from thread http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=22092

DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 01-Aug-2013 13:25:29   

Just set the compatibility-level to SQL2000.

Ruudster
User
Posts: 33
Joined: 13-Apr-2005
# Posted on: 01-Aug-2013 13:43:44   

Thanks, that solved the problem. Should've found it in the documentation... my mistake.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 02-Aug-2013 10:29:55   

It's an easy mistake to make when you're migrating from v2 to v4, as the default in v2 was sqlserver 2000 and in v4 it's sqlserver 2005+ simple_smile

Frans Bouma | Lead developer LLBLGen Pro