query a database on the same server

I have two databases (A, B) running under the same ASE server (S). The A and
B databases have the same strucute and table names. I want to query a table
in A from B, however I can't seem to get the syntax right. I thought it was
as follows:

SELECT * FROM [db].[user].[table]
SELECT * FROM A.DBA.myTable (query run from B)

However, this just seems to query the table of the same name in B, whereas I
want it to access the other database (A).

- Kevin


0
Kevin
4/2/2003 6:02:32 PM
sybase.ase.general 8655 articles. 0 followers. Follow

5 Replies
382 Views

Similar Articles

[PageSpeed] 0
Get it on Google Play
Get it on Apple App Store

"Kevin Howe" <khowe@perfnet.ca> wrote in message
news:OtS47JU#CHA.317@forums-1-dub...
> I have two databases (A, B) running under the same ASE server (S). The A
and
> B databases have the same strucute and table names. I want to query a
table
> in A from B, however I can't seem to get the syntax right. I thought it
was
> as follows:
>
> SELECT * FROM [db].[user].[table]
> SELECT * FROM A.DBA.myTable (query run from B)
>
> However, this just seems to query the table of the same name in B, whereas
I
> want it to access the other database (A).

You've got the right syntax.  Try the following:

SELECT * FROM A..myTable

or

SELECT * FROM A.dbo.myTable

See if that works... (I assume that the tables have different data - that's
why you're sure it's querying the wrong one?)

Justin.


0
Jus
4/2/2003 6:24:08 PM
> You've got the right syntax.  Try the following:
>
> SELECT * FROM A..myTable
> or
> SELECT * FROM A.dbo.myTable
>

Neither of those work.

> See if that works... (I assume that the tables have different data -
that's
> why you're sure it's querying the wrong one?)

Correct, they have the same structure, but the tables contain different
data.

I suppose I could set up a RemoteServer and a ProxyTable, but I was hoping
there was an easier way.

- Kevin



0
Kevin
4/2/2003 6:38:44 PM

Kevin Howe wrote:
> 
> > You've got the right syntax.  Try the following:
> >
> > SELECT * FROM A..myTable
> > or
> > SELECT * FROM A.dbo.myTable
> >
> 
> Neither of those work.
> 
> > See if that works... (I assume that the tables have different data -
> that's
> > why you're sure it's querying the wrong one?)
> 
> Correct, they have the same structure, but the tables contain different
> data.
> 
> I suppose I could set up a RemoteServer and a ProxyTable, but I was hoping
> there was an easier way.
> 
> - Kevin

Well, it certainly should work.  What @@version are you running on?

What results do you get with this script?

use a 
go
create table a (x char(20))
go
insert a values ("database a")
go
use b
go
select x from a..a
go
create table a (x char(20))
go
insert a values ("database b")
go
select x from a..a
select x from a
go
0
Bret
4/2/2003 6:51:28 PM
"Bret Halford" <bret@sybase.com> wrote in message
news:3E8B3130.19797718@sybase.com...
>
>
> Kevin Howe wrote:
> >
> > > You've got the right syntax.  Try the following:
> > >
> > > SELECT * FROM A..myTable
> > > or
> > > SELECT * FROM A.dbo.myTable
> > >
> >
> > Neither of those work.
> >
> > > See if that works... (I assume that the tables have different data -
> > that's
> > > why you're sure it's querying the wrong one?)
> >
> > Correct, they have the same structure, but the tables contain different
> > data.
> >
> > I suppose I could set up a RemoteServer and a ProxyTable, but I was
hoping
> > there was an easier way.
> >
> > - Kevin
>
> Well, it certainly should work.  What @@version are you running on?
>
> What results do you get with this script?
>
> use a
> go
> create table a (x char(20))
> go
> insert a values ("database a")
> go
> use b
> go
> select x from a..a
> go
> create table a (x char(20))
> go
> insert a values ("database b")
> go
> select x from a..a
> select x from a
> go

I'm running ASE 8.0.1.3067

The script doesn't not work, it's the calling mechanism that isn't
recognizing the reference. If I issue the command "use a" and then attempt
to make a select, it seems to just default to the current database (b)
instead of a.

- Kevin




0
Kevin
4/2/2003 8:16:02 PM


> I'm running ASE 8.0.1.3067
> 
> The script doesn't not work, it's the calling mechanism that isn't
> recognizing the reference. If I issue the command "use a" and then attempt
> to make a select, it seems to just default to the current database (b)
> instead of a.
> 
> - Kevin


Hi Kevin,

Well, here may be part of the problem:  There is no ASE version 8.
I think you may actually be running Adaptive Server Anywhere - in which 
case, please post your question to the sybase.public.sqlanywhere.general
newsgroup instead.  It's a different product, with syntax differences,
and you'll get more help in the right newsgroup.

-bret
0
Bret
4/2/2003 8:28:26 PM
Reply:

Similar Artilces:

Dev servers consolidation
I like to gather thoughts on how your firms setup Dev boxes for ASE servers. 1. Does any developer have their own ASE to work on? 2. Or they can share 1 ASE, with their own databases? My firm has too many ASE dev servers, I like to find a Good way to reduce ASE counts. If Oracle or MS-SQL or DB2 have better methods to accommodate more developers simultaneous working on 1 project, I like to know. Are there some 3rd party tool or home grown tools can facility create a big ASE with many many databases; and developers can do the works w/o interfere with each other. For example,...

GENERAL SQL SERVER: Question about the Script that setups the SQL Server Database.
This is the first time I have created a script for Sql Server 2000, and I have run into a few syntax ereas that I am not familar with. Bellow is a section of the script from the Portal server packages. At the end of the sample, is "ON [PRIMARY], Can anyone explain to me what this does and why the primary key isnt setup inside the code itself? I am basically trying to take parts of the script and incorrporate it into my own script and hate added syntax that I dont understand, makes debugging a real pain in the future. CREATE TABLE [dbo].[Portal_Announcements] ( [ItemID] [in...

General database query
Hello, I have a query in regard to setting up a simple database for the retail environment. It'll capture basic data such as name, address, order number, etc., etc.. Given all that SQL has to offer, would it be good practice to construct an online SQL database, or an Access one running locally. All suggestions welcome.  Thanks.  Avoid Access like the plague if at all possible. Go SQL Server every time if you can do it! Depends on how many users you plan to serve.  If it's one or two using the same workstation in one location, Access is the best option.  If its mu...

Unable to connect to database server: Database server not running
I get this error on one of my clients, although the DB server is, in fact, running. If I go to ODBC, and "TEST CONNECTION" it says OK, and all begins to work within a minute or so again. Sybase][ODBC Driver][Adaptive Server Anywhere]Unable to connect to database server: Database server not running Are there client settings, or server settings, which can eliminate this annoying problem? Our entire website stops working as it's completely db driven, until the error clears itself up... RUNNING ASA 6.0.3030 RT Can you post the parameters you filled in...

ASE to Rep Server to Rep Server to ASE Configuration
Hello I am hoping someone can help me. I am relatively new to Rep server and definately new to this configuration. I am trying to set up replication from ASE to Rep server to remote Rep Server to ASE. I am doing this type of configuration because the one ASE server is in North America and one is in England. This was recommended to me by Sybase becuase the transformation/language of Rep Server to Rep Server is quicker over the wan. Anyway. I have a ASE to rep server to ASE configuration and had no problem setting that up. Now I am trying to set up a new replication environme...

The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use not
Hello,          I receive this error  "The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.  Please enable the Service Broker for this database if you wish to use notifications." I attach the database in Management Studio to query and enable the broker using the scrip below but to no avail. ALTER DATABASE DataName SET ENABLE_BROKER ‘''<<------successfulandSELECT is_broker_enabled FROM sys.databases WHERE name = 'Database name' ‘'&...

General portal database queries
Hi I am currently running the IbuySpy Portal on my lap top using MSDE. Could anyone clarify a few points for me ... 1) If I buy SQL Server 2000 which I aim to do ... will this simply install over my MSDE and leave my portal database intact and run it as per normal? 2) I currently use web matrix to explore my portal database - I notice that in the users table of the portal the field size property for the key UserID field is set to "4" - does this in fact mean that there is only capacity to have 9999 users and then no more can be added? I assume this is correct. 3) Ab...

Query between two ASE Servers
I need make a query consulting two databases in two different ASE Servers (12.5.3) Is it possible? Thanks Israel. Sure is. Look at the CIS features of ASE in the manuals. Proxy tables are how you reference tables from another ASE server. "Israel Palacios" <desarrollador_sw@yahoo.es> wrote in message news:43fd51c2$1@forums-1-dub... > I need make a query consulting two databases in two different ASE Servers > (12.5.3) > Is it possible? > Thanks > Israel. > > Israel Palacios wrote: > I need make a query consulting two databa...

moving an sql server 2005 database to a sql server 2000 database
I am trying to move a database which I wrote in SQL Server 2005 to a SQL Server 2000 database. I'm not sure the best way to do this....... Can anyone enlighten me?.....   this article explains it. http://searchsqlserver.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid87_gci1149585_tax301536,00.html hth,mcm pizzamaker74: I am trying to move a database which I wrote in SQL Server 2005 to a SQL Server 2000 database. I'm not sure the best way to do this....... Can anyone enlighten me?..... If both are in the same network or box just register the 2005 with the 2000 cr...

Migrating sql server 2005 express database to sql server 2005 database
Hi, I have an application developed using VWD and sqlserver express database. The express database is turning out to be small in size and we need to migrate to larger sqlserver 2005 database. What are the steps for this migration, please list in detail. Regards, Sandyhttp://www.thequinn.infohttp://www.sksdataservices.comhttp://www.infobasket.info Hi Sandy, To move a database from SQL Express to SQL 2005, you can use the following steps. 1. If your database file is attached to the server instance, you will need to detach it first using SQL management studio. If it is under App_Data folde...

Question on cancelling a query on the ASE server
Hi, I wish to cancel a database query which is currently running on the dataserver. I am using ctlib. In one of the threads ctlib, executes ct_send and then waits in the ct_results loop. It is a query that can take some time to complete. In another thread, I issue ct_cancel command but that does not seem to affect the query on the server. I have tried all three CS_CANCEL_CURRENT, CS_CANCEL_ATTN and CS_CANCEL_ALL but nothing seems to work. I realised that the execution was waiting in the first iteration of ct_results and after some time when the query came out, it came out succ...

SQL Server Database File vs SQL Server Database -VWD Express
VWD Express 2008, SQL Server Express 2005. I have been using SQL Server Express with ASP and VB for some years - I just create a DB in Management Studio Express, have SQL Server set to 'SQL Server and Windows authentication', and use a connection string with 'sa' and a password (I never have managed to get it working with 'integrated security', but that is probably irrelevant to this post). So I have a list of DB's attached to SQL Server that I can see, attach, detach etc in MSE. I am getting started with .NET. Working through a VWD Express book tutori...

Signals/Events from the ASE Server/Database
Hi, I am writing an application that will monitor the health Database and teh Replication Server in my system. I want to know the signals or/and events taht the Database Server would broadcast when one of its database goes down (shutdown or database gets corrputed or something nasty happens)... Also, is it possible to monitor the Replication Server for such an event/signal when it is shutdown or goes down... Thanks Sudesh. The dataserver doesn't "broadcast" anything -- it just goes down and RepServer will find out soon enough because the connections are ...

Resource Constraints by Database on an ASE server
Is there anyway to create resource constraints for a database during ASE server contention. For example, I have 3 databases (DB1,DB2,DB) and I want to assign a maximum % threshold of processing time when the server is in heavy use. DB1 = 50% MAX DB2 = 25% MAX DB3 = 25% MAX Assuming the above is possible, is it also possible to configure the those constraints to be relaxed when the server is not under contention. So in the above example, if DB1 and DB2 are not doing anything, then DB3 can go above 25%, presumably all the way up to near 100%. Cyrus: Start Here: http://...

Web resources about - query a database on the same server - sybase.ase.general

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

Dodgy database exposes details of 191 million US voters
... years, there's a high chance that your personal details are now out in the wild. Security researcher Chris Vickery found a misconfigured database ...

Huge database of 191 million U.S. voters found on the open Internet
... such bulk information online, a recent discovery seems to indicate. According to VentureBeat , a security researcher found the exposed database ...

3.3 million Hello Kitty fans' details have been exposed in a huge database leak
... week after week, the hacks, breaches and data leaks continue to roll in. The latest victim? Hello Kitty. CSO Online is reporting that a database ...

Massive Voter Database Left Open For Public Consumption
Gosh, we could have avoided all the angst about the Clinton/Sanders voter database breach if only we'd known about this major database , accessible ...

Database configuration issues expose 191 million voter records
A misconfigured database has led to the disclosure of 191 million voter records. The database, discovered by researcher Chris Vickery, doesn't ...

Botched database leaks records for 191 million voters
... sometime this century? If so, your personal info may be out in the open. Researcher Chris Vickery has discovered that a badly configured database ...

191 Million US Voter Registration Records Leaked In Mystery Database
A huge database of 191 million US citizens is uncovered. But no one knows who carelessly left it open, whilst the FBI have been contacted.

Database Leak Exposes 3.3 Million 'Hello Kitty' Fans
... was accessible. Vickery told Reuters by e-mail that the company had plugged the holes he had found in three servers. But he said the database ...

Resources last updated: 1/9/2016 9:04:53 PM