Link to home
Start Free TrialLog in
Avatar of rrishi
rrishi

asked on

Loss of precision using OpenQuery

Hello,

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]()
      RETURNS TABLE
AS
RETURN
(
      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.

Please help!

Rishi
ASKER CERTIFIED SOLUTION
Avatar of g0rath
g0rath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ShogunWade
ShogunWade

what driver are you using in your linked server ?
Avatar of rrishi

ASKER

Thanks a lot, it seems to do the trick!
Im using OLEDB Jet 4.0 driver.