Gary,

When you connect to SQL Server via ODBC, add

:db_type => 'mssql'

as part of your connection string.  Then the SQL will work correctly.

DB[:patient].select(:'chart').first
I, [2010-03-11T22:30:57.640086 #7026]  INFO -- : SELECT TOP 1 [CHART]
FROM [PATIENT]
=> {:"chart number"=>"F-111801"}

Regards,

Michael
On Thu, Mar 11, 2010 at 7:24 AM, Gary Doades <[email protected]> wrote:
> There is a problem with sequel and MS SQL Server 2000.
>
> If I have a piece of sequel like this:
>
>  user = self.filter(:username => username).first
>
> it generates this SQL:
>
> SELECT TOP (1) * FROM [WRUSER] WHERE ([USERNAME] = N'user1')
>
> It's the TOP (1) that SQL Server 2000 doesn't like, it likes it as TOP
> 1 (i.e. without the brackets).
>
> SQLServer 2005 and 2008 also like the TOP 1 without the brackets so
> I'd like to know if it would be possible to change the SQL generation
> in this case to make it compatible with all 3 versions of SQL Server.
> We are trying to move to 2008 but all 230 of our production databases
> are currently 2000 :(
>
> Thanks,
> Gary.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sequel-talk?hl=en.
>
>



-- 
http://codeconnoisseur.org

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to