Showing posts with label second. Show all posts
Showing posts with label second. Show all posts

Sunday, February 19, 2012

Connection between 2 databases in local sql server

Hi,

I have two different applications based on SQL server database.

In one of the applications I need to use the information stored in the second database, only for read purpose.

As I understand I need how some to make a link between the databases in order to share tables.

Can anybody advise me how to do that, if it is possible at all?

Thanks

Just use a fully qualified name i.e. Server.Database.Owner.Table

for example: Select * from MyServer.Northwind.dbo.Customers

Regards

Paul

|||

Hi Paul,

Thanks for your replay, but maybe I'm not explained myself as well.

Because I'm accessing the database through ODBC, and when I'm using the specific DSN only the tables which are belongs to the specific database are available to me.

That’s the reason I though to make a link between the databases.

There is an option to do that?

|||

The easy way would be to create a stored procedure and have it do the work for you.

The hard way would be to establish 2 connections and query the tables seperately. If you are using .NET you could them combine them in a DataSet as two DataTables and establish a DataRelation.

Regards

Paul

|||

Hi Paul

Unfortunately I'm not using .NET, I'm working with VB6.

I'll appreciate it if you can be more specific about the stored procedure, how can I access the tables in the other database.

Thanks again

|||

Something like:

Create Proc MyProcedure
AS
select * from Db1.dbo.Table1 as tb1

inner join Db2.dbo.OtherTable as tb2
on tb1.id = tb2.id

Set the command type in an ADO Command object to a Stored Procedure and the CommnandText to MyProcedure (the stored procedure name) and call the execute method.

Sunday, February 12, 2012

Connecting to SQL Server from diffrent platform, Please HELP!

Hi,

This is second time that I ask this question in this forum but there was no answer last time I did this :(

What I have to do if I want to connect to MS SQL Server 2000 installed on Windows 2000 when I write a Visual Basic program on a Windows 98?
I mean, If I install a MS SQL Server 2000 on Windows 2000, and I want to connect to server with a Visual Basic programm that I write on a computer with Windows 98 operating system, I got "ACCESS DENIED" error :(
What I have to do to make it works?

Please help me about this problem, any Idea or article, web site and etc. you think it can help me!

Thanks again for you attention ;)Can you give some more details. How do you connect, are your logins correct etc. From your post it's impossible to know what the exact problem is.|||if you have access to where the db's are located the easiest way is to just create a .udl file in it and then you can gui wise select your driver and all that, it then creates the connection string for you when you open it in wordpad

you can see this everywhere, msdn,wrox books, teacher pass it off as their own too, this method has no origin because people always rip it off VERBATIM and never say where they got it from, *shrug*|||You've got response to your first question.

The "Access denied" error may be caused by the missing DCOM functionality (ADO works with ActiveX objects, which are communicating with (D)COM.