<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Why You Should Never Use SELECT Star (*)</title>
	<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/</link>
	<description>Life is too short to write bad SQL.</description>
	<pubDate>Tue, 07 Feb 2012 16:35:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1</generator>

	<item>
		<title>By: Curious George</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-10</link>
		<author>Curious George</author>
		<pubDate>Mon, 30 Jul 2007 19:48:33 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-10</guid>
					<description>I agree with the SELECT * fiasco.  But I wonder what your feelings are on using COUNT(*) to pull a quick return of total record count.  Is it viewed as wasteful, also?

EG: SELECT COUNT(*) FROM MY_TABLE

I kinda abuse that sql statement a lot, especially when I embed sql in VB code, to get a quick recordcount of a table so I can iterate through it w/o having to open it as a dynamic ADO so I can use the ADO.Recordset.Recordcount function.  (IE: I find it wasteful to open a recordset as a larger, dynamic object just so I can have access to it's recordcount, so I jury rig around it by using a COUNT(*) of the table first.)

Just curious about your thoughts on this.</description>
		<content:encoded><![CDATA[<p>I agree with the SELECT * fiasco.  But I wonder what your feelings are on using COUNT(*) to pull a quick return of total record count.  Is it viewed as wasteful, also?</p>
<p>EG: SELECT COUNT(*) FROM MY_TABLE</p>
<p>I kinda abuse that sql statement a lot, especially when I embed sql in VB code, to get a quick recordcount of a table so I can iterate through it w/o having to open it as a dynamic ADO so I can use the ADO.Recordset.Recordcount function.  (IE: I find it wasteful to open a recordset as a larger, dynamic object just so I can have access to it&#8217;s recordcount, so I jury rig around it by using a COUNT(*) of the table first.)</p>
<p>Just curious about your thoughts on this.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: jlango</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-293</link>
		<author>jlango</author>
		<pubDate>Fri, 26 Oct 2007 01:17:53 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-293</guid>
					<description>COUNT(*) is one of those damned-if-ya-do situations.  
Usually, the only way that you can get an accurate record count is to use COUNT(*).  So, you're kind of stuck using it.

I haven't written and VB code in a few years now.  I need to look at some of old VB code before I can speak to your question.</description>
		<content:encoded><![CDATA[<p>COUNT(*) is one of those damned-if-ya-do situations.<br />
Usually, the only way that you can get an accurate record count is to use COUNT(*).  So, you&#8217;re kind of stuck using it.</p>
<p>I haven&#8217;t written and VB code in a few years now.  I need to look at some of old VB code before I can speak to your question.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: [re-arrange]</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-12549</link>
		<author>[re-arrange]</author>
		<pubDate>Tue, 23 Nov 2010 20:32:51 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-12549</guid>
					<description>I don't view count(*) as wasteful, since the resultSet of total record count doesn't really return a large resultSet. Usually in most programming language it returns one single number. 

Most database can handle the row count using that count(*), btw.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t view count(*) as wasteful, since the resultSet of total record count doesn&#8217;t really return a large resultSet. Usually in most programming language it returns one single number. </p>
<p>Most database can handle the row count using that count(*), btw.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: hcpcs code books</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-12897</link>
		<author>hcpcs code books</author>
		<pubDate>Sun, 12 Dec 2010 17:29:29 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-12897</guid>
					<description>Hello admin! This is very helpful posting thanks.</description>
		<content:encoded><![CDATA[<p>Hello admin! This is very helpful posting thanks.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: ssokolow</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-12929</link>
		<author>ssokolow</author>
		<pubDate>Fri, 17 Dec 2010 17:19:40 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-12929</guid>
					<description>I forget which specific ones (It's been a while) but some databases actually apply extra optimizations on COUNT(*), relying on the implicit "Count returned rows" meaning.

I could be wrong, but I think it has something to do with how COUNT(column) interacts with NULL... possibly in the context of indexing.</description>
		<content:encoded><![CDATA[<p>I forget which specific ones (It&#8217;s been a while) but some databases actually apply extra optimizations on COUNT(*), relying on the implicit &#8220;Count returned rows&#8221; meaning.</p>
<p>I could be wrong, but I think it has something to do with how COUNT(column) interacts with NULL&#8230; possibly in the context of indexing.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Hcpcs Code Lookup</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-14861</link>
		<author>Hcpcs Code Lookup</author>
		<pubDate>Wed, 23 Mar 2011 15:38:41 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-14861</guid>
					<description>Hello admin, thanks for posting and link back to my site.</description>
		<content:encoded><![CDATA[<p>Hello admin, thanks for posting and link back to my site.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Hcpcs Codes</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-14873</link>
		<author>Hcpcs Codes</author>
		<pubDate>Thu, 24 Mar 2011 04:52:30 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-14873</guid>
					<description>Hello admin, thanks for posting and link back to my site.</description>
		<content:encoded><![CDATA[<p>Hello admin, thanks for posting and link back to my site.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Ricky</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-15209</link>
		<author>Ricky</author>
		<pubDate>Fri, 15 Apr 2011 09:04:17 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-15209</guid>
					<description>"When you run a SELECT *, most databases will cache which fields are returned from this. This means that if you add a field to a table, an existing SELECT * query will not return the field!."

This is certainly bullshit.</description>
		<content:encoded><![CDATA[<p>&#8220;When you run a SELECT *, most databases will cache which fields are returned from this. This means that if you add a field to a table, an existing SELECT * query will not return the field!.&#8221;</p>
<p>This is certainly bullshit.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Dave D</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-15800</link>
		<author>Dave D</author>
		<pubDate>Thu, 26 May 2011 10:35:18 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-15800</guid>
					<description>Select * is wrong because it broke your app ? Sounds more like your app didn't handle a result that the query could have returned. I use Select * in some code (&#38; Select field1, field2 etc in other code) because I want all fields &#38; my code is robust enough to handle whatever result the query returns. Also what Ricky says about BS is correct.</description>
		<content:encoded><![CDATA[<p>Select * is wrong because it broke your app ? Sounds more like your app didn&#8217;t handle a result that the query could have returned. I use Select * in some code (&amp; Select field1, field2 etc in other code) because I want all fields &amp; my code is robust enough to handle whatever result the query returns. Also what Ricky says about BS is correct.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: jlango</title>
		<link>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-15801</link>
		<author>jlango</author>
		<pubDate>Thu, 26 May 2011 11:18:20 +0000</pubDate>
		<guid>http://www.joelango.com/2007/04/30/why-you-should-never-use-select-star/#comment-15801</guid>
					<description>Okay, I wrote this like 5 years ago.  I can guarantee that this behavior happened then.  I haven't tested it since then, and using ORM probably makes this moot anyway.  But since you're all having so much fun commenting on a 5-year old post, go for it.  After, you and Ricky can go find a post from 2003 complaining that T-SQL doesn't have try/catch statements, and call that bullshit too.</description>
		<content:encoded><![CDATA[<p>Okay, I wrote this like 5 years ago.  I can guarantee that this behavior happened then.  I haven&#8217;t tested it since then, and using ORM probably makes this moot anyway.  But since you&#8217;re all having so much fun commenting on a 5-year old post, go for it.  After, you and Ricky can go find a post from 2003 complaining that T-SQL doesn&#8217;t have try/catch statements, and call that bullshit too.</p>
]]></content:encoded>
				</item>
</channel>
</rss>

