Reputation: 16966
I find myself writing SQL code (queries or stored procs) to solve problems that can definitely be defined as 'patterns' that occur frequently in business.
Rather than having to wrack my brain each time I encounter a new problem (which must have been solved a countless times by other coders/db analysts, I wondered if there was a repository I could go to check out (peer reviewed) code - and maybe add my two pence every now and then. I know different db vendors tend to write slightly variant forms of SQL - but there could still be a repository with ANSI stuff and proprietary stuff. Hopefully, such a site would encourage more people to write standardized SQL.
Is there such a site?. If no - why not? (would anyone else be interested in such a site?) If such a site exists, please provide link(s), as Google is not finding anything remotely useful.
Upvotes: 7
Views: 2267
Reputation: 27478
Unfortunately SQL is not as standard as it should be, there are several incompatable implemnetations of DATE, TIME, DATETIME and TIMESTAMP, Oracle has NUMBER, DB2 has DECIMAL, there the ANSI standard covers only a few functions, there is no standard for sotred procedures.
SO the short answer is no. However the various DBMS specific Forums contain a wealth of SQL example statements.
I would go the DBMS specific route as there is nothing more frustrating than locating a piece of SQL that solves you problem precisely but only works on SQLServer when your data is in Oracle.
Upvotes: 0
Reputation: 11987
there are a ton of scripts available at http://www.sqlservercentral.com/Scripts/, and you can also contribute scripts there. not sure that meets the repository criteria.
i'd love to see something more collaborative where you could check out edit and commit code to a location, but it sounds like something you could do with just a subversion server and a web interface.
Upvotes: 2
Reputation: 3544
Snipplr is a user-contributed repository for SQL snippets as well as other code snippets for many other languages.
Upvotes: 2