× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Mike,

My experience with SQL functions is limted (just made one), but I am not
thrilled by it. The main reason: a terrible performance at times, something
I would not present to my users. And the function would be called for each
row it fetches and may return in your result set.

If you do this only for building the start date and end date, I would use a
CTE, if possible, so that has to be done only once.

Just my 2 cents.

With regards,
Carel Teijgeler


*********** REPLY SEPARATOR ***********

On 9-2-2011 at 15:39 Mike Wills wrote:

I am working on some SQL statements for an ASP.NET application. One of the
things that is required is to only display information in an open period.
The period is updated automatically by the vendor software as the previous
period is closed. So I finding myself doing a bunch of sub selects like:

where date >= (SELECT DATE(CONCAT('20', CONCAT(YY, CONCAT('-', CONCAT(
MM, (CONCAT('-', DD))))))) FROM LIB/FILE')

Yes, each portion of the date is in separate fields.

Would making this query a function make the query more efficient? I have
never created a function before how would I do that? My thought is having
something like:

IsInRange(date)

So I can do "WHERE IsInRange(date)".

Or is there a better way?




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.