philippe.grondier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-25 21:40 UTC
INSERTS with MS SQL Server columns with newid() default values
My first steps in RoR .. and it turns into a bad dream when it come to
SQL Server!
I have this table ''Tbl_People'', with 2 fields
id_People primary key, automatically generated by SQL Server
with newid() default value,
namePeople is a string
I have an ODBC connection to the database. I can list the records,
but ... I cannot make any inserts in the table. The INSERT string
generated by Ruby is the following:
INSERT INTO Tbl_People (id_People, namePeople) VALUES(''newid'',
''GRONDIER, Evelyne'')
And will be refused because the string ''newid'' cannot be
inserted in
the uniqueindentifier/primary key field ''id_People''.
The error returned is: ''DBI::DatabaseError: 37000 (8169) [Microsoft]
[ODBC SQL Server Driver][SQL Server]Conversion failed when converting
from a character string to uniqueidentifier''
It seems to be so obviously a big and basic problem that I feel I
missed something usually written in bold on each RoR training document
such as ''Don''t try INSERTs through
RoR'',''uniqueIdentifier is Chinese
to RoR'', or ''RoR doesn''t work with MS SQL
Server''...
Any idea?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---