473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Linked Server Query Problem

Hi All,
I have created a linked server on SQL Server 2005 to access data from DB2.
I am able to execute it with the command "SELECT * FROM OPENQUERY(DB2SRV, 'SELECT * FROM dbname.dbowner.tblname') however, not able to execute the same thing with "SELECT * FROM DB2SRV.dbname.dbowner.tblname". Seems very strange.
Any help in this regard will be appreciated.
Thanks in advance for any reply.

Ashwin
Oct 8 '07 #1
4 6241
iburyak
1,017 Expert 512MB
In Enterprise Manager when you go to Security – Linked Servers can you see DB2SRV name?
If yes when you expend this name can you see Tables?
If yes, when you click on it, can you see all tables?
If answer to any of these questions is ‘NO’ it means your linked is not configured properly.



Good Luck.
Oct 8 '07 #2
Hi,
Thanks for your reply. Further, I have successfuly configured the linked server
but now another issue.

I have set up Linked Server to DB2 using MS OLEDB FOR ODBC DRIVER (MSDASQL) i am able to execute select, insert and delete but there are few tables in DB2 where data type of some of the columns is CLOB.

I am not able to select, update or insert in to the DB2 tables. I guess it is the problem of data type mismatch between SQL Server and DB2. Can any body help me how to select DB2's CLOB data type in SQL Server through OPENQUERY and how to insert a text data value into DB2 CLOB data type column.

Currently when i Insert the following error is encountered :

OLE DB provider "MSDASQL" for linked server "TRYLINK" returned message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".

Msg 7344, Level 16, State 1, Line 1

The OLE DB provider "MSDASQL" for linked server "TRYLINK" could not INSERT INTO table "[MSDASQL]" because of column "MEMO_FALSEPOSITIVE". Could not convert the data value due to reasons other than sign mismatch or overflow.

When i try to select a CLOB column in DB2 the following error is encountered:

OLE DB provider "MSDASQL" for linked server "TRYLINK" returned message "Requested conversion is not supported.".

Msg 7341, Level 16, State 2, Line 1

Cannot get the current row value of column "[MSDASQL].MEMO_VULNERABILITYSOLUTION" from OLE DB provider "MSDASQL" for linked server "TRYLINK".

Thanks in advance for any answer.

Ashwin



In Enterprise Manager when you go to Security – Linked Servers can you see DB2SRV name?
If yes when you expend this name can you see Tables?
If yes, when you click on it, can you see all tables?
If answer to any of these questions is ‘NO’ it means your linked is not configured properly.



Good Luck.
Oct 10 '07 #3
iburyak
1,017 Expert 512MB
Sorry I am not a DB2 programmer and can't help you with this but can you create a view on DB2 side where you convert to text this column before returning to SQL so conversion on SQL side would not require.

To update you probably can create a stored procedure on DB2 side which will do conversion for you.


Not sure if it is even possible but it is just a thought.

You can go to DB2 forum for help.

Good Luck.
Oct 10 '07 #4
Hi,
Thanks for the reply. Well I had the same thought but the problem is there is no text data type in DB2 another way is varchar is there in DB2 but CLOB type data will not be accomodated in varchar so no sense in that. Another way i found is to have DB2 column get converted in XML data type which is also there in SQL Server 2005 so tried that but another problem is when i run select query using OPENQUERY to access xml data type from DB2 the error is
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '('.
My query goes like this................

SELECT str_tmp.value('(/tbltmp/@Description) [1]', 'varchar(max)')
FROM OPENQUERY(VTDEV149, 'SELECT str_tmp.value('(/tbltmp/@Description) [1]', 'varchar(max)')' from tvng.tvnguser.tbltmp)

I don't understand where i am wrong.

Please suggest something if u can.

bye..
Ashwin


Sorry I am not a DB2 programmer and can't help you with this but can you create a view on DB2 side where you convert to text this column before returning to SQL so conversion on SQL side would not require.

To update you probably can create a stored procedure on DB2 side which will do conversion for you.


Not sure if it is even possible but it is just a thought.

You can go to DB2 forum for help.

Good Luck.
Oct 11 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
5
by: Bernie | last post by:
Greetings, I have 3 servers all running SQL Server 2000 - 8.00.818. Lets call them parent, child1, and child 2. On parent, I create a view called item as follows: CREATE view Item as...
1
by: Larryboy | last post by:
We have a need to retrieve Sybase data within a MS SQL Server application. We are using SQL Server's linked database feature with the Sybase 12.0 OLE DB driver. It takes 5 minutes to run a query...
2
by: BoB Teijema | last post by:
Hi all, One of our companies is having problems with a query on a linked server. They have two servers, serverA and serverB. On serverA they have set up a linked server to serverB. Query:...
1
by: mahajan.sanjeev | last post by:
Hi All, I am accessing a linked server (also a SQL Server) from a stored procedure. There is an insert statement that I run on a table in the linked server. This statement causes the Internal...
7
by: Joe | last post by:
I am using Access 2003 and are linking to an Oracle 9i ODBC datasource (using Oracle ODBC drivers). After linking the tables in Access, I inspect the data contained in the linked tables. For...
5
by: Neil | last post by:
I am getting time-out errors when I try to perform a simple delete on a linked server. The command is: Delete From MyTable Where PKID=12345 I have tried executing this command directly from...
2
by: sqlgirl | last post by:
Hi, We have 2 servers. Server1 is a 2000 box, with SP3 (yes I know it is not up to date). Server2 is a 2005 box, SP2. I set up Server1 (2000) to have a linked server to Server2 (2005). The...
0
by: Nathan | last post by:
Hi, Got a frustrating problem. I have sql express, running on a 2k3 server on my network. i have created a linked server to an access db located on the same server. The tables on the linked...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.