{"id":1484,"date":"2012-09-11T20:08:06","date_gmt":"2012-09-12T01:08:06","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=1484"},"modified":"2021-03-11T12:46:23","modified_gmt":"2021-03-11T17:46:23","slug":"powerbuilder-gotcha-column-lists-do-not-match","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-gotcha-column-lists-do-not-match\/","title":{"rendered":"PowerBuilder &#8216;Gotcha&#8217; &#8211; Column lists do not match"},"content":{"rendered":"<p>This is more of a database driver error but I encountered it within a datawindow I was working on so PB gets credit.<\/p>\n<p>I was working on a generic data drill down control which has a filtering process to eliminate data based on a date argument.  Since I also wanted this date value for other purposes (expressions) on the datawindow I decided to include it within the result set.  There are a variety of ways to do the same thing but this is what I fixated on while figuring out the control&#8217;s functionality.  Initially my SQL was something like this (MS SQL Server 2008):<\/p>\n<pre>...\n,IsNull(part_name, &#039;No Part&#039;) AS part_name\n,:adt_date AS svc_date\n...<\/pre>\n<p>Everything is fine but during my testing I encountered the message: &#8220;Select Error: Column lists do not match.&#8221;<\/p>\n<p>Hmmm&#8230;<\/p>\n<p>Running a SQL trace gave this result for the query:<\/p>\n<pre>...\n,IsNull(part_name, &#039;No Part&#039;) AS part_name\n,NULL AS svc_date\n...<\/pre>\n<p>So my date argument in this case was null.  I could code in PowerBuilder to ensure the paramenter is always populated with a date but I preferred to following:<\/p>\n<pre>...\n,IsNull(part_name, &#039;No Part&#039;) AS part_name\n,IsNull(:adt_date, Getdate()) AS svc_date\n...<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is more of a database driver error but I encountered it within a datawindow I was working on so PB gets credit. I was working on a generic data drill down control which has a filtering process to eliminate data based on a date argument. Since I also wanted this date value for other&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,3,10],"tags":[21,12,16,15],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1484"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=1484"}],"version-history":[{"count":3,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1484\/revisions"}],"predecessor-version":[{"id":2054,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1484\/revisions\/2054"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=1484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=1484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=1484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}