Results of MoonPhase Calculation

Listing 2. After you compile and deploy the assembly from Listing 1, you can use the function just like any other scalar function as part of a query. Here are the results.

OrderDate               SubTotal              PctOfCycle
----------------------- --------------------- ----------------------
2001-07-01 00:00:00.000 24643.9362            0.349136471385022
2001-07-01 00:00:00.000 1553.1035             0.349136471385022
2001-07-02 00:00:00.000 3578.27               0.383000338638662
2001-07-03 00:00:00.000 3578.27               0.416864205892302
2001-07-04 00:00:00.000 3578.27               0.450728073145943
2001-07-05 00:00:00.000 3578.27               0.484591940399583