Hi Jeremy,

i ran in following situation on a MS SQL Database (tiny_tds adapter used):

irb(main):036:0> DB_OVS[:xxx].where(ausleuchtung_vorhanden: nil).count
=> 61
irb(main):038:0> DB_OVS[:xxx].where(ausleuchtung_vorhanden: "nein").count
=> 17
irb(main):037:0> DB_OVS[:xxx].where(ausleuchtung_vorhanden: [nil, 
"nein"]).count
=> 17
irb(main):039:0> DB_OVS[:xxx].where(ausleuchtung_vorhanden: [nil, 
"nein"]).sql
=> "SELECT * FROM [xxx].[xxx] WHERE ([AUSLEUCHTUNG_VORHANDEN] IN (NULL, 
N'nein'))"

I suggest that MS SQL DB cant handle the IN clause with NULL values and 
real values but im not a expert. I fixed it by using:

DB_OVS[:xxx].where(ausleuchtung_vorhanden: nil).or(ausleuchtung_vorhanden: 
["nein"]).count
irb(main):044:0> 
DB_OVS[:dbo__drg_v_onlinebestandsfuehrung].where(ausleuchtung_vorhanden: 
nil).or(ausleuchtung_vorhanden: ["nein"]).sql
=> "SELECT * FROM [xxx].[xxx] WHERE (([AUSLEUCHTUNG_VORHANDEN] IS NULL) OR 
([AUSLEUCHTUNG_VORHANDEN] IN (N'nein')))"

But i would love to use Array that can contain Nil, so that i dont have to 
split the searched values in Nil and other values.

Is it possible to fix hat generated SQL's in case of that Database types? I 
tested in PostgreSQL and saw that it can handle that generated SQL.

Thank you in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to