Yesterday I was using Sequel to export some data from MS SQL Server using a bunch of sprocs. Within these sprocs were statements that create temp tables and I kept coming across:
column does not allow nulls. INSERT fails. /home/ttilberg/.rvm/gems/ruby-2.2.5/gems/sequel-4.41.0/lib/sequel/adapters/tinytds.rb:218:in `fields': TinyTds::Error: Cannot insert the value NULL into column 'tire_category', table 'tempdb.dbo.#custom_out___________0000000003EA'; column does not allow nulls. INSERT fails. (Sequel::NotNullConstraintViolation) I tracked the issue down to the TinyTDS level and asked the maintainer for his take on it, with lots of description of the issue. https://github.com/rails-sqlserver/tiny_tds/issues/248#issuecomment-283763324 He mentioned: I think the issue is that a pure DBLIB connection needs a few sane > configurations set. We do this in the ActiveRecord adapter for TinyTDS. and proceeds to show a few settings that get set by default in the activerecord-sqlserver gem <https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/master/lib/active_record/connection_adapters/sqlserver_adapter.rb#L373-L379> It turns out executing `SET ANSI_DEFAULTS ON` fixed my issue. I am curious if some of these same defaults seen in the activerecrd-sqlserver gem would also make sense in sequel/adapters/tinytds (or even shared/mssql)? I see that `TEXTSIZE` is set if it's specified, but I didn't see any matches for `ANSI` or some others that Metaskills sets in activerecord. This could potentially be a hazardous change, but I'm curious what your take on it is. -- 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 sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.