|
date: Fri, 31 Mar 2017 07:27:06 +0200
from: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
subject: RE: SQL UDF to return one column from a row
What About:
Create View YourFirstView
As (Select a.*, yourText
From yourFile a Join YourTextFile on ....);
Create View NextView
As (Select *
From YourFirstView ....)
Then use the view you need (no need to code anything over and over again).
UDFs perform normally worse than joins. A UDF is for the query optimizer a
black box.
Joins are visible to the query optimizer, independent whether they are
entered directly or whether they are located in even nested views.
In this way the query optimizer can find better solutions when using views
contrary to UDFs.
Example: If you have a UDF that returns the customer name.
With an UDF a "chain" must be performed for each row. If the same customer
is returned in multiple rows, the UDF is called for each row.
If a JOIN is used instead, the optimizer might be able to find an access
plan that reads the customer information only once.
Mit freundlichen Gr??en / Best regards
Birgitta Hauser
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.