<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Storing the SQL queries in the database</title>
	<atom:link href="http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/</link>
	<description>Tango, photography and whatever&#039;s bleeding edge</description>
	<lastBuildDate>Wed, 17 Mar 2010 02:53:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Louie</title>
		<link>http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/comment-page-1/#comment-431579</link>
		<dc:creator>Louie</dc:creator>
		<pubDate>Fri, 01 Jan 2010 08:12:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/#comment-431579</guid>
		<description>I have the same idea some 5 years ago to store SQL within the database itself for my programs (but I didn&#039;t really implemented it yet :P).  This is because it usually takes too long to go through the deployment cycle if I need to add / modify my sql statements.  However, I think it is the best to use it only in reporting related things (as those data input parts actually requires a lot more of validation, business logics, etc).
  
My idea is quite similar to yours: a table of sqlID/sql queries/parameter list/version#.  

In order to make it work in reporting environment, I am assuming my queries operates in a set of predefined parameters, e.g. %CategoryID%, %ContactID%, %OrganizationID%, %StaffID% etc.  And in the UI, we always know what these parameters refer to and how to fill in the dynamic queries in a well controlled manner -- e.g. StaffID is always the login user or select from a drop down, or user can select from a list of categories from radio buttons. etc.

As I use dot net, the parameters will be maintained in a name value pair array (maybe a dictionary type as well)

1 challenge is how you configure the parameters to an FieldName IN (a,b,c) type.  I think you need to define a different #ParameterList# parameter which evalues to &quot;Field in (&#039;a&#039;,&#039;b&#039;,&#039;c&#039;)&quot;  or &quot;Field in (a,b,c)&quot; 

Louie :)</description>
		<content:encoded><![CDATA[<p>I have the same idea some 5 years ago to store SQL within the database itself for my programs (but I didn&#8217;t really implemented it yet <img src='http://blog.forret.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ).  This is because it usually takes too long to go through the deployment cycle if I need to add / modify my sql statements.  However, I think it is the best to use it only in reporting related things (as those data input parts actually requires a lot more of validation, business logics, etc).</p>
<p>My idea is quite similar to yours: a table of sqlID/sql queries/parameter list/version#.  </p>
<p>In order to make it work in reporting environment, I am assuming my queries operates in a set of predefined parameters, e.g. %CategoryID%, %ContactID%, %OrganizationID%, %StaffID% etc.  And in the UI, we always know what these parameters refer to and how to fill in the dynamic queries in a well controlled manner &#8212; e.g. StaffID is always the login user or select from a drop down, or user can select from a list of categories from radio buttons. etc.</p>
<p>As I use dot net, the parameters will be maintained in a name value pair array (maybe a dictionary type as well)</p>
<p>1 challenge is how you configure the parameters to an FieldName IN (a,b,c) type.  I think you need to define a different #ParameterList# parameter which evalues to &#8220;Field in (&#8216;a&#8217;,'b&#8217;,'c&#8217;)&#8221;  or &#8220;Field in (a,b,c)&#8221; </p>
<p>Louie <img src='http://blog.forret.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek</title>
		<link>http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/comment-page-1/#comment-180340</link>
		<dc:creator>Abhishek</dc:creator>
		<pubDate>Tue, 27 Nov 2007 20:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/#comment-180340</guid>
		<description>Hi,

How can i put substitution varable into the Access Database sql query, It will ask user to give the prompt answer</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>How can i put substitution varable into the Access Database sql query, It will ask user to give the prompt answer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/comment-page-1/#comment-576</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Sun, 02 Apr 2006 14:22:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/#comment-576</guid>
		<description>Good question.
If one were to start using stored procedures, and then add logical naming of the procedures, add web-based editing with versioning, add a mechanism for passing a variable number of parameters and encapsulate everything in a piece of code, one would probably arrive at something quite similar.
My system would work with a sissy database like Access, but once you have a more mature RDBMS (SQL-Server, mySQL, Oracle, Postgres), using stored procedures to implement it is obviously a best practice. But it&#039;s more than just that.</description>
		<content:encoded><![CDATA[<p>Good question.<br />
If one were to start using stored procedures, and then add logical naming of the procedures, add web-based editing with versioning, add a mechanism for passing a variable number of parameters and encapsulate everything in a piece of code, one would probably arrive at something quite similar.<br />
My system would work with a sissy database like Access, but once you have a more mature RDBMS (SQL-Server, mySQL, Oracle, Postgres), using stored procedures to implement it is obviously a best practice. But it&#8217;s more than just that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LVB</title>
		<link>http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/comment-page-1/#comment-555</link>
		<dc:creator>LVB</dc:creator>
		<pubDate>Sat, 01 Apr 2006 18:03:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.forret.com/2006/03/storing-the-sql-queries-in-the-database/#comment-555</guid>
		<description>What&#039;s the essential difference between your idea and stored procedures? I mean, which of your 5 advantages cannot be obtained by applying the standard stored procedures approach?</description>
		<content:encoded><![CDATA[<p>What&#8217;s the essential difference between your idea and stored procedures? I mean, which of your 5 advantages cannot be obtained by applying the standard stored procedures approach?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.558 seconds -->
