Article ID: 116332
Article Last Modified on 3/11/2000
CREATE TABLE test(col1 float) INSERT into test VALUES(2.9) SELECT col1 FROM test WHERE col1=2.9However, the following query shows the row with col1=2.9
SELECT * FROM testThis does not happen when the insert is done from a DB-Library (DB-Lib) client tool, or if direct, non-prepared execution is used. For the SQL Server driver, if the users do not have CREATE PROC permission, direct, non-prepared execution is used.
Dim db As Database
Dim ds As Dynaset
Set ds = db.CreateDynaset("SELECT * FROM test")
ds.AddNew
ds.Fields("col1") = 2.9
ds.Update
Then a query which checks for equality of the float column to the value
inserted does not show the record inserted above, whereas a non-qualified
query shows the record. For example, the recordset for the ds1 dynaset does
not show the record inserted, whereas ds2 dynaset will.
Set ds1 = db.CreateDynaset("SELECT * FROM test WHERE col1=2.9")
Set ds2 = db.CreateDynaset("SELECT * FROM test")
For an ODBC application writer, the following steps will produce the
behavior:
//Prepared execution to update the table SQLPrepare: INSERT INTO test VALUES (?) //Set parameters for the above prepared stmt SQLSetParam: //Execute the previously prepared stmt //and verify that it returned SQL_SUCCESS SQLExecute: //Execute the following query SQLExecDirect: SELECT * FROM test WHERE col1=2.9And then retrieve the result to see that the record inserted above does not show up. However, executing the following shows the record inserted above:
//Execute the following query SQLExecDirect: SELECT * FROM test
UPDATE test SET f= (CONVERT(FLOAT, CONVERT(VARCHAR, col1)))You can also do the same thing within a trigger to automatically update the value for all new records inserted.
Additional query words: 1.01.2807 VB DBLibrary stored procedure
Keywords: kbprb KB116332