• tony28 (10/17/2013)


    I thinking about modify to ITVF, but i think it will be very hard and slowlier like one query...

    1. I have to declare variable

    2. alone queries are very faster, but together like function is problem,, but it has sometimes different behaviour like i wrote above.

    3. I tried replace without variable and it looks very bad with repeate selects. for example select for work_date,work_date_pre and etc.

    Post the DDL for the tables, sample data for the tables, and expected results based on given input and sample data. Your function can be rewritten as an itvf and it will perform better than the function you currently have.