General information
Category:
Visual FoxPro Beta
Using the "SELECT IDENTITY_VAL_LOCAL() as KeyID, Last_Update FROM BASI.Presidents" I was able to get the KeyID field to return the new ID#. The Last_update returns the time from the first record in the table. Also the Tableupdate still returns false. The error is "The refresh key defined for table is not unique." No Table mentioned now. On additional Tableupdate()s it continues to insert into the database, update the same record in cursor over and over again.
Maybe I have to wait for the final release to get this working.
>>This is the syntax I used to create the table:
>>
>>CREATE TABLE BASI.PRESIDENTS(KeyID INT NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,LoginID CHAR(8), ...
>>
>>DB2 does the Key generation, I can't tell you much more than that. In VFP8 I use "SELECT IDENTITY_VAL_LOCAL() as NewIDValue FROM SYSIBM.SYSDUMMY1" To return a cursor with the last Key generated.
>
>For the InsertCmdRefreshCmd, try that SQL Select instead --
>
>SELECT IDENTITY_VAL_LOCAL() as KeyID FROM SYSIBM.SYSDUMMY1
>
>FWIW, I did not do the testing using ODBC. I used ADO instead. I also tried selecting the current value of my generated PK from Oracle with no success [same error message as you got]. So, I am not holding out any hope that selecting the IDENTITY value will work in DB2 right now using ODBC or ADO. It does work in SQL Server though, and selecting the KEYID value from the source table in Oracle does work.
>
>Does DB2 have the CAST() function where you might try:
>
>SELECT CAST(IDENTITY_VAL_LOCAL() AS Integer) as KeyID FROM SYSIBM.SYSDUMMY1
>
>... or cast it as whatever numeric data type is available in DB2 (e.g., NUMBER(8,0) or some such).
>
>Don't get too discouraged, as the VFP Team is aware of this issue with non-SQL Server DBs and are working to correct it.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only