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_IM O]()
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
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_IM
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what driver are you using in your linked server ?
ASKER
Thanks a lot, it seems to do the trick!
Im using OLEDB Jet 4.0 driver.
Im using OLEDB Jet 4.0 driver.