I have to create different query for different database like Oracle,Mysql,Mssql .but i want to create only one generic query which runs or should works on all different database like Oracle,Mysql,Mssql.
@PaulWhite Good point. Removed from commented section too as it might be useful if user wants table valued-function. Any chance for vote up? Just saying :) — Pavel Nefyodov18 mins ago
I looked at the question a few days ago but I couldn't find a way with window functions. It seems not difficult with a recursive but I couldn't get around it with window functions.
@PaulWhite The problem in that Q is much like some part of the SQLUG (Swedish SQL Server User Group) challenge for this year. Link to something Swedish. It is about calculating reimbursements for doctors based on visits and a code. The T codes have a rule that says that they should only be used if they where not used within the last 90 days.
@ypercube You should post a recursive solution. That is what the question asks for, after all. I suppose a window function solution will be more interesting, and probably more efficient if done well.
@MikaelEriksson Yes these problems come up semi-regularly it seems. Ought to be easy, doubt it is.
The question seems flawed though. Is he expecting the TVF-in-a-computed-column to automatically recalculate when any affected underlying data changes? Cos he'll be disappointed.
@ypercube You have until Sunday but you also have to be a member of the UG. Prize is I believe 950 swedish kronor and the honor of calling yourself the swedish champion of TSQL for one year.
@ypercube So far yes. These preliminary results sometimes change because they sometimes add more data for the final run. I also have one more version (max 3 version) that I can file and it looks like that one will cut my times down by 50% or so. At least in my tests with my test data.
A punched card, punch card, IBM card, or Hollerith card is a piece of stiff paper that contained either commands for controlling automated machinery or data for data processing applications. Both commands and data were represented by the presence or absence of holes in predefined positions.
Now obsolete as a recording medium, punched cards were widely used throughout the 19th century for controlling textile looms and in the late 19th and early 20th century for controlling fairground organs and related instruments. Punched cards were used through most of the 20th century in what became known as...