Loss of precision using OpenQuery
Posted on 2004-09-07
I have created a function which returns records from a linked server using OPENQUERY (text file delimited with ';') into a TABLE variable.
CREATE FUNCTION [dbo].[fct_PremierTable_IMO]()
SELECT ZPRXSO, ZPRXVT, ZTVARV
FROM OPENQUERY (IMO, 'SELECT * FROM IMMOS.txt')
The target Table variable is as follows:
DECLARE @tTable TABLE
IDENTITE INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,
ZPRXSO DECIMAL(18,2), ZPRXVT DECIMAL(18,2), ZTVARV DECIMAL(18,2)
The problem is that the decimal part of the values are lost. For example, 2356 is obtained instead of 2356.58.
I have tried to use VARCHAR instead of DECIMAL without any success.