tag:blogger.com,1999:blog-16959946.post1412250211187041929..comments2023-12-09T16:44:47.897+01:00Comments on The Data Charmer: Boost your SQL with Proxy loopsGiuseppe Maxiahttp://www.blogger.com/profile/15801583338057324813noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-16959946.post-81070388108624117412011-10-13T17:47:18.173+02:002011-10-13T17:47:18.173+02:00@Scott I use the sproc by Ron Savage here:
http:/...@Scott I use the sproc by Ron Savage here:<br /><br />http://stackoverflow.com/questions/510012/get-a-list-of-dates-between-two-dates<br /><br />to do something like what you mentioned.John Hirbourhttps://www.blogger.com/profile/11070910474825188225noreply@blogger.comtag:blogger.com,1999:blog-16959946.post-6456611695569264882007-08-15T23:04:00.000+02:002007-08-15T23:04:00.000+02:00Scott,The macro in this example is a simple syntax...Scott,<BR/>The macro in this example is a simple syntax enhancement recognized in the proxy.<BR/>The server knows nothing about it.<BR/>What you ask is feasible, although it would require a level of parsing much deeper and more complex than the one currently being used.<BR/>Tables with all the dates from a distant past to a foreseeable future are not a silly thing. For example, Anthony Molinaro's <A HREF="http://www.oreilly.com/catalog/sqlckbk/" REL="nofollow">SQL Cookbook</A> uses them cleverly.<BR/>I use them as well, and I wrote <A HREF="http://datacharmer.blogspot.com/2006/06/filling-test-tables-quickly.html" REL="nofollow">a post</A> about creating them quickly.Giuseppe Maxiahttps://www.blogger.com/profile/15801583338057324813noreply@blogger.comtag:blogger.com,1999:blog-16959946.post-55663870462573212392007-08-15T21:31:00.000+02:002007-08-15T21:31:00.000+02:00Some folks on Freenode have asked about building a...Some folks on Freenode have asked about building a table containing every date within a range, in order to left join some other table. So if I have a table of orders, and on some days there were no orders, my result set can fill in the missing days with 0. We can of course just build a table containing all dates from now until the distant future, but that feels kinda kludgy.<BR/><BR/>So, can the results of the loop show up as a derived table? SELECT * FROM (FOR 1 5 SELECT $N) AS range...Scotthttps://www.blogger.com/profile/09696813570058056053noreply@blogger.com