advice on querying DB

  • Thread starter Thread starter Mark
  • Start date Start date
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
 
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!
**********************************************************************
 
Back
Top