Hi everybody,
I noticed recently that insert and create literalize same time stamp
differently. Here is my example.
DB.create_table? :tests do
primary_key :id
DateTime :posted_at
end
class Test < Sequel::Model
end
date = '2011-11-10T00:00:00-00:00'
Test.create({:posted_at=>date})
produces => INSERT INTO [TESTS] ([POSTED_AT]) OUTPUT [INSERTED].*
VALUES ('2011-11-09 18:00:00.000')
which is correct sequel converts input time stamp to local CST from
UTC
Test.insert({:posted_at=>date})
produces => INSERT INTO [TESTS] ([POSTED_AT]) VALUES
(N'2011-11-10T00:00:00-00:00')
there is no timezone conversion and SQL generates exception when
executed
NativeException: com.microsoft.sqlserver.jdbc.SQLServerException:
Conversion failed when converting date and/or time from character
string.
Same result observed when DB insert is used
DB[:tests].insert({:posted_at=>date})
Why insert and create produce different SQL?
Any idea why SQL Server doesn't like '2011-11-10T00:00:00-00:00' with
timezone. it is ISO 8601 complaint. However, removing timezone makes
SQL server much more happy. It eats it just fine.
Database: MS SQL 2008
Sequel: 3.29
JRUBY : 1.6.2
Thanks
--
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.