[R-sig-DB] sqlSave: error 22018 Invalid character value for cast specification

XFM XFM @end|ng |rom xx
Mon Jul 6 09:03:04 CEST 2009


apparently the table is created but the data is not sent in the right
format: the date list field is created as float instead of datetime.
Any idea to help me?

On Mon, Jul 6, 2009 at 2:12 PM, XFM<XFM using xx> wrote:
> I have found that, I dont know if it corresponds to my issue and how I
> can apply the solution in the case of RODBC
> http://support.microsoft.com/kb/269011
>
>
> On Mon, Jul 6, 2009 at 1:55 PM, XFM<XFM using xx> wrote:
>> Hi,
>>
>> I try to use RODBC to upload dataframes to a SQL Server.
>>
>> here is what odbcGetInfo returns:
>>
>>> odbcGetInfo(channel)
>>            DBMS_Name               "Microsoft SQL Server"
>>            DBMS_Ver                   "10.00.1600"
>>            Driver_ODBC_Ver          "03.52"
>>            Data_Source_Name      "databasefundamental4ecap"
>>            Driver_Name                 "SQLSRV32.DLL"
>>            Driver_Ver                    "03.85.1132"
>>            ODBC_Ver                   "03.52.0000"
>>            Server_Name                 "name_of_my_server"
>>
>>
>> I have dowloaded a data.frame using
>>
>>> PRICE = sqlQuery(channel, query).
>>
>> PRICE looks like that:
>>
>>         cdate        PRICE
>> 1  2009-06-15    0.8242105
>> 2  2009-06-12    0.7942105
>> 3  2009-06-11    0.8236842
>> 4  2009-06-10    0.8178947
>> 5  2009-06-09    0.8531579
>> 6  2009-06-08    0.9715790
>> 7  2009-06-05    0.8984211
>> 8  2009-06-04    0.8536842
>> 9  2009-06-03    0.9510526
>> 10 2009-06-02    0.8547368
>>
>>
>> I try now to upload it back to the database, in a new table. I have
>> not changed anything in the format or in the values of the data.frame.
>> I have done:
>>
>>> PRICE2 = PRICE
>>> sqlSave(channel, PRICE2)
>>
>> It returns me the following error:
>>
>>> sqlSave(channel, PRICE2)
>> Error in sqlSave(channel, PRICE2) : [RODBC] Failed exec in Update
>> 22018 0 [Microsoft][ODBC SQL Server Driver]Invalid character value for
>> cast specification
>>
>> If a try it again, I have the following error:
>>> sqlSave(channel, PRICE2)
>> Error in sqlSave(channel, PRICE2) :  table ‘PRICE2’ already exists
>>
>>
>> Can somebody help me on that?
>>
>> Thank you
>> Xavier
>>
>




More information about the R-sig-DB mailing list