<?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: Assign SELECT results into variables</title> <atom:link href="http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/feed/" rel="self" type="application/rss+xml" /><link>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/</link> <description>季庄新闻--Haidong Ji's Blog</description> <lastBuildDate>Wed, 04 Jan 2012 09:32:09 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.2</generator> <item><title>By: Chris Hedgate</title><link>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/comment-page-1/#comment-2493</link> <dc:creator>Chris Hedgate</dc:creator> <pubDate>Fri, 09 Feb 2007 16:44:04 +0000</pubDate> <guid
isPermaLink="false">http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/#comment-2493</guid> <description>Exactly, in my opinion a program should fail as fast as possible instead of hiding possible errors and fail in inconsistent ways later.
The family is great, Kiron is 9,5 months and is just starting to walk. He is a fantastic kid, always happy. But I guess most parents feel that way about their own kids. :)
Everything good with you and the family as well?</description> <content:encoded><![CDATA[<p>Exactly, in my opinion a program should fail as fast as possible instead of hiding possible errors and fail in inconsistent ways later.</p><p>The family is great, Kiron is 9,5 months and is just starting to walk. He is a fantastic kid, always happy. But I guess most parents feel that way about their own kids. <img
src='http://www.haidongji.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Everything good with you and the family as well?</p> ]]></content:encoded> </item> <item><title>By: Haidong Ji</title><link>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/comment-page-1/#comment-2492</link> <dc:creator>Haidong Ji</dc:creator> <pubDate>Fri, 09 Feb 2007 16:32:03 +0000</pubDate> <guid
isPermaLink="false">http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/#comment-2492</guid> <description>Thanks Chris. That is a great point! That is a great defensive coding practice. Better safe than sorry.
Glad you are back. Hope all is well with you and the family.</description> <content:encoded><![CDATA[<p>Thanks Chris. That is a great point! That is a great defensive coding practice. Better safe than sorry.</p><p>Glad you are back. Hope all is well with you and the family.</p> ]]></content:encoded> </item> <item><title>By: Chris Hedgate</title><link>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/comment-page-1/#comment-2488</link> <dc:creator>Chris Hedgate</dc:creator> <pubDate>Fri, 09 Feb 2007 07:34:33 +0000</pubDate> <guid
isPermaLink="false">http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/#comment-2488</guid> <description>Hey Haidong, long time since I read your blog, but now it&#039;s back in the feed reader again.
Regarding this post, I prefer the following query:
set @MyVariable = (select ColumnName from MyTable where MyId = SomeInteger)
Note that this is not exactly the same query though. This will result in an error if the select-statement returns multiple rows. The query that you used will not result in an error, @MyVariable will be assigned the value of the column ColumnName in the last row of the resultset. Of course, this might be what you want, but if not I think it is better to fail fast.</description> <content:encoded><![CDATA[<p>Hey Haidong, long time since I read your blog, but now it&#8217;s back in the feed reader again.</p><p>Regarding this post, I prefer the following query:</p><p>set @MyVariable = (select ColumnName from MyTable where MyId = SomeInteger)</p><p>Note that this is not exactly the same query though. This will result in an error if the select-statement returns multiple rows. The query that you used will not result in an error, @MyVariable will be assigned the value of the column ColumnName in the last row of the resultset. Of course, this might be what you want, but if not I think it is better to fail fast.</p> ]]></content:encoded> </item> </channel> </rss>
