On Friday, July 20, 2012 1:46:24 PM UTC-7, Duc Qui wrote:
>
> I'm using SQL Server 2008 and sequel 3.37
>
> If you do a simple db[:table].select( ['a','b','c'].sql_string_join.as
> (:test)).sql
>
> Result is
> SELECT ('a' || 'b' || 'c') AS [test] FROM [table]
>
> Correct SQL
> SELECT ('a' + 'b' + 'c') AS [test] FROM [table]
>

Most likely you aren't loading the MSSQL syntax support.  Here's what I get:

  DB[:table].select( ['a','b','c'].sql_string_join.as(:test)).sql
  => "SELECT (N'a' + N'b' + N'c') AS [TEST] FROM [TABLE]"

In addition to the + instead of || for string concatentation, the MSSQL 
syntax support automatically upcases identifiers and uses unicode string 
literals by default.

You can check which type of database Sequel thinks you are using via:

  DB.database_type
  => :mssql

If you don't get :mssql, then that's what the problem is.  How are you 
creating your db object?

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/PP-lhWry9sEJ.
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