|
Posted by Erland Sommarskog on 01/02/08 22:35
gumby (gumbysolutions@cox.net) writes:
> I would like to call this stored procedure, but I am unable to pass
> parameters to the @Start and @End.
>
> Is thier a way to pass parameters to a pass through query from MS
> Access?
I really hope there is. Unfortunately, this is an SQL Server forum
and not an Access forum, so it's not the best place for advice.
As long as the queries are submitted through ADO you can use
..CreateParameter to specify the parameters. But I don't know if
what is meant with pass-through queries. (I have no experience of
Access myself.)
You are probably better off asking in an Access forum. But what I can
say from the SQL Server side of things is that you should never expand
parameter values directly into the query string, but always use
parameterised commands. There are three reasons for this:
1) If you expand the parameters, each new parameter values results in
a new cache entry, resulting in higher load on SQL Server for
compilation and memory.
2) Parameterised commands protects you against SQL injection, that is
a user entering data which affects the SQL syntax.
3) No problems with date values. For instance the snippet that
Tom van Stiphout will not work for French, German or British users.
So if pass-through queries in Access actually do not support parameters,
the answer is simple: don't use them.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|