hi, i am upgrading an Access97 mdb to Access2002 adp. As part of the
exercise i am implementing further security by utilising stored procedures
[quoted text clipped - 6 lines]
Hi Stuart,
In a SQL stored procedure you can use a join instead of the DLOOKUP
function. If the lookup criteria is a unique one then an outer join is
equivalent to a DLOOKUP. The obvious difference between a join and a
lookup is when the criteria isn't unique. In that case DLOOKUP will
return an arbitrary value from the set of matching rows while a join
will return _every_ row.
This is an example of why it is important to have a solid logical model
to start with. Jet databases in Access permit non-deterministic results
based on the arbitrary order in which rows are stored and processed
internally. For very good reasons, SQL generally does not support those
kinds of results (admittedly there are one or two exceptions in SQL but
we usually try to avoid them because unpredictable results aren't
usually what we want).
In conclusion, do not assume that a data model designed for Access will
be suitable for SQL Server. You should review your logical data model
and it is wise to assume that you will have to make some changes in
order to implement it properly in SQL. If your data model is normalized
to at least BCNF level then you should always be able to replace
DLOOKUP with a join, perhaps utilizing a derived table or subquery as
well.
Hope this helps.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--