473,406 Members | 2,705 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,406 software developers and data experts.

Stored Procedure querying another database

Hello,

I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?

Thanks,

Marek

Feb 6 '07 #1
7 16394
On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,

I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?

Thanks,

Marek
Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries

Feb 6 '07 #2
On Feb 6, 5:09 pm, "Steve" <morrisz...@hotmail.comwrote:
On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,
I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?
Thanks,
Marek

Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

Feb 6 '07 #3
mk******@gmail.com (mk******@gmail.com) writes:
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?
To refer to an object on a remote server, you must use four-part
notation: server.catalog.schema.table. So that's why
INKEDSERVERNAME.SCHEMA.TABLE does not work.

Unfortunately, I have no idea what will work, since I've never heard of
Unidata before.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 6 '07 #4
On Feb 6, 6:07 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
mkarb...@gmail.com (mkarb...@gmail.com) writes:
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

To refer to an object on a remote server, you must use four-part
notation: server.catalog.schema.table. So that's why
INKEDSERVERNAME.SCHEMA.TABLE does not work.

Unfortunately, I have no idea what will work, since I've never heard of
Unidata before.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
I started using the 4 part query and I guess I got a step further;
now I'm getting a different error:

the query is: SELECT * FROM AVLIVE..ii.SODET_NF

the error:
[OLE/DB provider returned message: Unspecified error]
[OLE/DB provider returned message: [Ardent][UniData ODBC
Driver]Invalid column number.]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
IDBSchemaRowset::GetRowset returned 0x80004005: ].
Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.

Any idea what this error means?

Feb 6 '07 #5
Marek,

In order to use a linked server, the server has to be capable of a four part
namespace. Your example was only showing a three part namespace.

You were using:
LINKEDSERVERNAME.SCHEMA.TABLE

You need to be able to specify:
LINKEDSERVERNAME.DATABASE.SCHEMA.TABLE

Do the ODBC drivers and databases you are using support a four-part name. If
they don't, then you will have to use OPENROWSET.

I don't know about SQL 2005, but in SQL 2K you can not inherit any part of
the namespace if the database is on a different server. The following won't
work:

LINKEDSERVERNAME.DATABASE..TABLE

-- Bill

<mk******@gmail.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
On Feb 6, 5:09 pm, "Steve" <morrisz...@hotmail.comwrote:
>On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,
I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?
Thanks,
Marek

Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries

I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

Feb 6 '07 #6
On Feb 6, 6:18 pm, "AlterEgo" <altereg...@dslextreme.comwrote:
Marek,

In order to use a linked server, the server has to be capable of a four part
namespace. Your example was only showing a three part namespace.

You were using:
LINKEDSERVERNAME.SCHEMA.TABLE

You need to be able to specify:
LINKEDSERVERNAME.DATABASE.SCHEMA.TABLE

Do the ODBC drivers and databases you are using support a four-part name. If
they don't, then you will have to use OPENROWSET.

I don't know about SQL 2005, but in SQL 2K you can not inherit any part of
the namespace if the database is on a different server. The following won't
work:

LINKEDSERVERNAME.DATABASE..TABLE

-- Bill

<mkarb...@gmail.comwrote in message

news:11*********************@m58g2000cwm.googlegro ups.com...
On Feb 6, 5:09 pm, "Steve" <morrisz...@hotmail.comwrote:
On Feb 6, 1:25 pm, "mkarb...@gmail.com" <mkarb...@gmail.comwrote:
Hello,
I need to come up with a stored procedure that will allow me to read
data from another database. The database I need to read the data from
is a UniData residing on a Unix server. The stored procedure needs to
reside on my sql 2005 server. The task is very simple in Access as we
have ODBC connections set up to the UniData via Informix (or IBM)
UniData ODBC drivers. I can easily combine my UniData and Sql Server
tables from within access. However, I can't seem to find a way to
replicate the same behavior in MS SQL Stored Procedure without the use
of Access. Is that even possible?
Thanks,
Marek
Linked server or OPENROWSET
In SQL Server 2005 Books Online see the topic: Distributed Queries
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?- Hide quoted text -

- Show quoted text -
thanks for all your help; indeed with OPENROWSET I was able to get
the query working with no problems (or at least the problems I'm
having are not related to the tables, rather with Error converting
data type DBTYPE_DBDATE to datetime, but that's a topic for another
thread if I can't figure it out)

Feb 7 '07 #7
marek,

You can't use inherited names. In other words, don't put two periods
together. See my other post.

-- Bill

<mk******@gmail.comwrote in message
news:11********************@v45g2000cwv.googlegrou ps.com...
On Feb 6, 6:07 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
>mkarb...@gmail.com (mkarb...@gmail.com) writes:
I started playing around with the linked server and I got it to the
point where I can see the tables from UniData, but when I try to query
it using LINKEDSERVERNAME...TABLE I get 'Invalid schema or catalog
specified for provider 'MSDASQL'." error. When I try to specify
schema using LINKEDSERVERNAME.SCHEMA.TABLE I get 'Invalid object name
LINKEDSERVERNAME.SCHEMA.TABLE'; do you know why these errors occur
and how to get around them?

To refer to an object on a remote server, you must use four-part
notation: server.catalog.schema.table. So that's why
INKEDSERVERNAME.SCHEMA.TABLE does not work.

Unfortunately, I have no idea what will work, since I've never heard of
Unidata before.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005
athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000
athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

I started using the 4 part query and I guess I got a step further;
now I'm getting a different error:

the query is: SELECT * FROM AVLIVE..ii.SODET_NF

the error:
[OLE/DB provider returned message: Unspecified error]
[OLE/DB provider returned message: [Ardent][UniData ODBC
Driver]Invalid column number.]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
IDBSchemaRowset::GetRowset returned 0x80004005: ].
Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.

Any idea what this error means?

Feb 7 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Trosen | last post by:
Hi Everyone, I hope someone can help, I'm pretty new to pro*c programming. I have the following application setup: a pro*c program calls a stored procedure and recieves a cursor back: the...
3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
3
by: nandan | last post by:
Hi, Has any one ever compared the performance of calling a DataTable's Select method with a stored procedure doing the same thing? My point is: dataRows = DataTable.Select(filter) is better or...
4
by: Robin Tucker | last post by:
Hi, I'm trying to determine with my program whether or not a given database supports a given feature set. To do this I'm querying for certain stored procedures in the sysobjects table and if...
7
by: Együd Csaba | last post by:
Hi, I've a problem with some of my stored procs. My config is: RH7.1, Postgres 7.3.2 I had converted a few fields of a few tables from one type to another and after this I made all the...
3
by: Samarth | last post by:
Folks, I am calling a DB2 stored procedure through Perl using the DBI:ODBC module. I am not sure if I can do this or not because I have been able to connect to and also issue select statements...
2
by: James Foreman | last post by:
I'm building a stored procedure that simulates cars arriving in a car park, and staying for different amounts of time, based on historical data. So, first I define a cursor that's populated by...
4
by: dougjrs | last post by:
Good Afternoon, I have a Java stored procedure on DB2 z/OS and it is using the Type 4 JDBC driver to access an Oracle database. After I get the data from the Oracle dataabse I try to return it...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.