advice on querying DB

M

Mark

Hi
i have 2 tables on seperate DBs (lets say localDB and
NotLocalDB, seperate servers!)
I want to cycle through the BookingRef Field in LocalDB
and query NotLocalDB with the bookingRefs
Then i want to return the IDs from NotLocalDB where they
match

what I need to know is efficency, and how i should do it

Should I just query the NotLocalDB one by one
or should i collate all the bookingRefs in LocalDb and
then chuck them all at the NotLocalDB ?
would i need a stored proc on the notLocalDB to do this
because and i cant do that

any direction appreciated
Also a tutorial on create a db connection and returning
results to variable would be great!
thanks
Mark
 
C

Cowboy \(Gregory A. Beamer\)

Any time you open two connections, you increase overhead. You can reduce the
appearance of overhead by linking servers. In SQL Server this is relatively
easy. You can then make a query to one and use the link to connect to both.

For efficiency, you might also consider some form of replication, so you
have a single point of contact. For example, you might replicate NotLocalDB
to a DB on the LocalDB server. You then have a single server (two databases)
to query, which makes it easy to chain the two DBs.

In .NET, the quick start samples (which are available at gotdotnet.com or by
installing them on your local machine (the install is under .NET Framework
on the Program menu)) give plenty of samples for a variety of topics. The
site asp.net is also a nice trove of info for working with ASP.NET.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top