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?