The query below is working fine:
SELECT *
FROM OPENQUERY(DS_64, 'SELECT TOP 1 * FROM "workforce"."sales" WHERE ORDER_UPDATED > ''2020-07-24 14:03:23'' ')
When I'm using ORDER_CREATED in place of ORDER_UPDATED, I'm getting the below error:
OLE DB provider "MSDASQL" for linked server "DS_64" returned message
"[SAP AG][LIBODBCHDB DLL][HDBODBC] General error;314 numeric overflow:
search table error: [6944] exception 70006944: AttributeEngine:
overflow in numeric calculation
Any help is going to be highly appreciated. Thanks in advance :)
Below is the query that is giving the above error:
SELECT *
FROM OPENQUERY(DS_64, 'SELECT TOP 1 * FROM "workforce"."sales" WHERE ORDER_CREATED > ''2020-07-24 14:03:23'' ')
I think the syntax for top is limited in the HANA universe. Also, check the datatype HANA is actually using from HANA Studio.
Related
I have the below query that is trying to pull data from Sage 50 pervasive 13 database into SQL server using a link server. I've been able to pull all data from all tables into SQL Server except for this one table because it has a space in the table name.
I've not been successful with anything I've changed it to. Can anyone help me get this query working?
select *
from openquery(ARKSAGE,'select * from NEPHROPATHOLOGYASSO1.Budget Details')
When I change the above query to this:
select *
from openquery(ARKSAGE,'select * from NEPHROPATHOLOGYASSO1.[Budget Details]')
I get this error message:
OLE DB provider "MSDASQL" for linked server "ARKSAGE" returned message "[PSQL][ODBC Client Interface][LNA][PSQL][SQL Engine]Syntax Error: select * from NEPHROPATHOLOGYASSO1.<< ??? >>[Budget Details]".
Msg 7321, Level 16, State 2, Line 61
An error occurred while preparing the query "select * from NEPHROPATHOLOGYASSO1.[Budget Details]" for execution against OLE DB provider "MSDASQL" for linked server "ARKSAGE".
The PSQL in the error message tells me the linked server is probably running Postgresql, rather than SQL Server. Postgresql marks object names with double quotes instead of brackets. Therefore you should try this:
select *
from openquery(ARKSAGE,'select * from NEPHROPATHOLOGYASSO1."Budget Details"')
Additionally, I'm not sure what the << ??? >> text is for, but it looks a little like it's complaining about an odd unicode character in there somewhere. So look out for invisible whitespace. Or maybe it's just part of how the error message is formatted in the context of a linked Postgresql server.
Select to Sybase table from SQL Server (by LinkedServer) getting error "The OLE DB provider "MSDASQL" for linked server "XXX" supplied inconsistent metadata for a column. The column "XXXX" (compile-time ordinal 1) of object "db.schema.table" was reported to have a "DBCOLUMNFLAGS_ISFIXEDLENGTH" of 16
Query: Select * from [Server].[db].[schema].[table]
Finally after searching some time in the web found the answer, when makes a query on a table having a nullable CHAR column gives the error...
So the solution was create a View in Sybase where I make an ISNULL Validation for the specific column, and from the SQL Server query the View instead the table.
Query: Select * from [Server].[db].[schema].[view]
Source: http://www.dbainfo.net/wp-content/uploads/CR/sdk_17.htm
I'm facing a difficult to run 'SUM' syntax from a linked server(PostgreSQL) in MSSQL, the connection created via ODBC driver.
If I only retrieve the data, there isn't any problem,
select * from OpenQuery([192.168.1.145],'
select party_code, amount_forex from biv_so_main
')
If I try to sum the value, it throws an error,
select * from OpenQuery([192.168.1.145],'
select party_code, sum(amount_forex) from biv_so_main group by party_code
')
Error message
The OLE DB provider "MSDASQL" for linked server "192.168.1.145" supplied inconsistent metadata for a column. The column "sum" (compile-time ordinal 2) of object "
select party_code, sum(amount_forex) from biv_so_main group by party_code
" was reported to have a "SCALE" of 6 at compile time and 2 at run time.
I googled a lot, seems nobody has the same issue like me, anybody can help?
Thanks.
add an alias to your sum column and cast into a datatype (into whatever type amount_forex is).
select * from OpenQuery([192.168.1.145],'
select party_code
, sum(amount_forex)::int amount_forex_sum
from biv_so_main group by party_code
')
When obtaining an image grabde with sql server linked servers from PostgreSQL, I get the following error: OLE DB provider 'MSDASQL' for linked server 'bd_acceso_ruisegip' returned data that does not match expected data length for column '[MSDASQL] . fot_imagen '. The data length (maximum) expected is 255 and the data returned is 38471.
Don't know if you were dealing with a bytea column but I was having the same problem. Found the answer in the configuring of the postrgres ODBC system dsn. Under the Options/Datasource-page 2 there is a option for bytea as LO. Clicked that and now it works like a champ.
I found a similar issue when replicating some Forum data from PostgreSQL to MSSQL, using the PostgreSQL 64-bit driver and a Linked Server (.
When I coded like this:...
select * into Post from OpenQuery(PostgreSQL_Test1, 'select * From public.post')
... the MSSQL table defaulted to a column size of nvarchar(4000).
My fix: First, run it once with a small limit on the number of rows copied:
select * into Post from OpenQuery(PostgreSQL_Test1, 'select * From public.post limit 10')
Next, right-click on the local Post table. Choose "Script table as drop and create"
In the create script, replace the size of the offending column with VARCHAR(MAX)
Next, create the table.
Then use:
Insert Post select * from OpenQuery(PostgreSQL_Test1, 'select * From public.post')
Hope that helps.
Your mileage may vary.
I am trying to do a query via ODBC to our ERP database. The documentation guide suggests that we use OPENQUERY to send the query.
Here is my example query
SELECT
Q.Part_No,
Q.[Description],
Q.Part_Type
FROM OPENQUERY
(
LINKEDSERVER,
'
SELECT
P.Part_No,
P.[Description],
P.Part_Type
FROM LINKEDSERVER...Part_V_Part AS P
WHERE P.Part_No = ''2712768''
'
) AS Q
When I try to run that query though I get the following error
OLE DB provider "MSDASQL" for linked server "LINKEDSERVER" returned message "[LINKED][ODBC Plex ODBC Report Data Source driver][OpenAccess SDK SQL Engine]Syntax error in SQL statement. syntax error line 1 at or after token <LINKEDSERVER>.[0]".
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "
SELECT
P.Part_No,
P.[Description],
P.Part_Type
FROM LINKEDSERVER...Part_V_Part AS P
WHERE P.Part_No = '2712768'
" for execution against OLE DB provider "MSDASQL" for linked server "LINKEDSERVER".
Can anyone help me here? I've never used OPENQUERY before, but I'm coping the example straight as it is in the example documentation.
Should be like this
SELECT
Q.Part_No,
Q.[Description],
Q.Part_Type
FROM OPENQUERY
(
LINKEDSERVER,
'
SELECT
P.Part_No,
P.[Description],
P.Part_Type
FROM DatabaseName.SchemaName.Part_V_Part AS P
WHERE P.Part_No = ''2712768''
'
) AS Q
Replace DatabaseName and SchemaName with your actual database name and schemaname (probably dbo)
You don't need the linked server name inside the query
Take a look at Having Fun With OPENQUERY And Update,Delete And Insert Statements for some examples