Posts Tagged ‘mssql’

h1

Time and MSSQL

August 7, 2008

Today i want to blog about an issue we noticed few days ago.

We use MSSQL DB for our Ruby on Rails Webapplication. We got a lot of data replicated from other systems, so we also got created_at and updated_at columns filled.

After successfull replication we just clicking through the application and wonder why the created_at and updated_at data is not displaying.

The created_at / updated_at data in the database looks like ‚2008-07-18 00:00:00‘.
Some playing shows us if we add 1 second to the Date it was showing up.

Customer.all.collect {|c| c.update_attributes(:created_at => Time.parse(c.created_at_before_type_cast)+1.second)}

Strange… it seems that mssql and jruby have a problem with datetime columns where time is 00:00:00.

Im going to update this post if any solution is found, or posted by you in the comments.

Advertisements