(this question was originally posted in another forum a few months ago, without getting any answer ... there was no SO at these times!)
My first steps in RoR. I baught one of these books talking about Ruby, and Ruby On Rails. Examples are running correctly on MySQL, so I decided to rewrite them for MS-SQL as a good exercice (and as MS-SQL is our standard database).. and it turned into a bad dream:
I have this table with 2 fields
Tbl_People
----------
id_People primary key, newid() default value,
namePeople 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, Philippe')
And will be refused because the string 'newid' cannot be inserted in the uniqueindentifier/primary key field id_People
. Logically, 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?