|
Posted by Erland Sommarskog on 10/25/05 13:17
Ken Post (nntp.post@gmail.com) writes:
> Had a table UDF, not Scalar UDF for the function that returned the
> address number and some messed up thinking.
>
> Here's what I've got now, and it works just fine.
>
> SELECT
> Possibles.*,
> dbo.udf_ReturnAddress(FoundPersonID, 1) AS FullAddr1,
> dbo.udf_ReturnAddress(FoundPersonID, 2) AS FullAddr2
> FROM
> dbo.udf_ReturnPossibleDupsForAPerson(@PersonID) Possibles
>
> WAYYYY simpler now.
OK, but what is this udf_ReturnAddress actually doing? Is just doing a
plain lookup with a SELECT statement, like:
BEGIN
RETURN (SELECT FullAddress FROM addresses
WHERE PersonId = @personid AND Adrno = @no)
END
In such case, rewrite into a join for a considerable performance
improvement.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Navigation:
[Reply to this message]
|