Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 7th, 2003, 10:41 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass-through queries vs stored procedures

I would like to know if pass-through queries in Access 97 are the same as stored procedures. If not which is more efficient I have a font end application in Access '97 that has to connects to sybase database.

Thank you

Reply With Quote
  #2 (permalink)  
Old October 8th, 2003, 02:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 10 Times in 9 Posts
Default

They are two different things. A stored procedure is a compiled SQL statment that runs on your database server; a pass-through query is basically any valid SQL statement that is sent to your database server from Access over an ODBC connection, thereby by-passing the Jet engine entirely, and any operations it would normally perform on a Jet query (e.g., syntax checking/parsing).

Pass-through queries, however, can be a really effective way of executing stored procedures on your database server. For example, if you wanted to get a list of customers from your server, you could create a stored procedure like:

CREATE PROC up_select_customers
AS
SELECT * FROM Customers

then use the following as your pass-through queries SQL statement:

exec up_select_customers

Pass-through queries that return values (SELECT statements), however, are read-only, but you can also execute stored procedures on your server to run DML SQL statments (inserts, updates, deletes) that don't return values.

When using a pass-through query, you'll need to set some additional properties that Jet queries don't require, noteably an ODBC Connect Str property, which can be either a DSN or a string value like:

ODBC;Driver={SQL Server};Server=(local);Database=MotherOfAllDatabas es;UID=sa;PWD=itsasecret

and the Returns Records property (boolean), ODBC Timeout and Max Records (the last two are optional).

Also, you can't create pass-through queries in the QBE grid. Instead, select Query -> SQL Specific -> Pass-Through in the Access query designer and type in your SQL directly. Since your pass-through queries are parsed on the server, however, you might want to create them there using your DBMS client tools, parse them, then copy them and paste them into Access. That way you know they'll run when they hit the server.

As far as performance goes, stored procedures are about as good as it gets, so using pass-through queries to execute them is a great combination. Plus, since you're using a .mdb file (i.e. Jet is present) you can always cache returned data in local Jet tables, and save yourself a bunch of trips to the server.

I've used pass-through queries that execute stored procedures a bunch with SQL Sever, but never with Sybase, so I can't speak to that, but the general principles apply.

HTH,

Bob











Reply With Quote
  #3 (permalink)  
Old October 8th, 2003, 03:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 10 Times in 9 Posts
Default

The succinct formula might be something like:

Pass-through queries originate on the client; stored procedures originate on the server. Combined, they provide an excellent mechanism for client/server data exchange.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
STORED PROCEDURES shazia1 SQL Server ASP 7 September 26th, 2007 07:11 AM
stored procedures thillaiarasu ASP.NET 2.0 Basics 2 May 3rd, 2007 08:55 AM
Converting Access Queries Into Stored Procedures markw SQL Language 1 March 15th, 2005 11:49 AM
SQL Pass though parameters to stored procedures blinton25 SQL Server 2000 3 March 29th, 2004 02:49 PM
Using Stored Procedures lintacious Classic ASP Basics 1 August 12th, 2003 05:06 PM



All times are GMT -4. The time now is 05:50 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.