 




<?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: SQL Server 2000 script</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/sql-script-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-script-2/</link>
	<description></description>
	<lastBuildDate>Thu, 23 May 2013 01:41:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-script-2/#comment-58546</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Thu, 11 Dec 2008 23:31:16 +0000</pubDate>
		<guid isPermaLink="false">#comment-58546</guid>
		<description><![CDATA[Sorry - you call it as:

select dbo.NthFromLastPrice(&lt;itemnumber&gt;, 2)
   (or use your appropriate database object name)

Brain freeze while typing.]]></description>
		<content:encoded><![CDATA[<p>Sorry &#8211; you call it as:</p>
<p>select dbo.NthFromLastPrice(&lt;itemnumber&gt;, 2)<br />
   (or use your appropriate database object name)</p>
<p>Brain freeze while typing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-script-2/#comment-58545</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Thu, 11 Dec 2008 23:23:01 +0000</pubDate>
		<guid isPermaLink="false">#comment-58545</guid>
		<description><![CDATA[Did you try using the function I provided?  (NthFromLastPrice)

You will need to change the table and column names to match your database, but I have tested it and it will return the correct price.  Simply call it with the item number (or other index to the item collection) and &quot;2&quot; for the 2nd parameter.

Once it compiles (with the right table and column names), you can easily test it with:

select * from NthFromLastPrice(&lt;itemnumber&gt;, 2)]]></description>
		<content:encoded><![CDATA[<p>Did you try using the function I provided?  (NthFromLastPrice)</p>
<p>You will need to change the table and column names to match your database, but I have tested it and it will return the correct price.  Simply call it with the item number (or other index to the item collection) and &#8220;2&#8243; for the 2nd parameter.</p>
<p>Once it compiles (with the right table and column names), you can easily test it with:</p>
<p>select * from NthFromLastPrice(&lt;itemnumber&gt;, 2)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brentsheets</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-script-2/#comment-58525</link>
		<dc:creator>brentsheets</dc:creator>
		<pubDate>Thu, 11 Dec 2008 14:28:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-58525</guid>
		<description><![CDATA[&lt;b&gt;Moved by Moderator for &lt;a href=&quot;http://itknowledgeexchange.techtarget.com/profile/Beginer2008&quot;&gt;Beginer2008&lt;/a&gt;:&lt;/b&gt;
Let make clear my question.. I got an Item and update new price in every new quarter. Usually we&#039;ll call Max(Effect_date) to retrieve latest price. But now we&#039;d like to call last updated price (last before latest price) instead latest price.
I&#039;ve tried as per yours advice yet error prompt.]]></description>
		<content:encoded><![CDATA[<p><b>Moved by Moderator for <a href="http://itknowledgeexchange.techtarget.com/profile/Beginer2008">Beginer2008</a>:</b><br />
Let make clear my question.. I got an Item and update new price in every new quarter. Usually we&#8217;ll call Max(Effect_date) to retrieve latest price. But now we&#8217;d like to call last updated price (last before latest price) instead latest price.<br />
I&#8217;ve tried as per yours advice yet error prompt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mrdenny</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-script-2/#comment-58476</link>
		<dc:creator>mrdenny</dc:creator>
		<pubDate>Wed, 10 Dec 2008 12:07:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-58476</guid>
		<description><![CDATA[Neither of those ROWNUMBER examples will work.  SQL Server 2000 doesn&#039;t have that function, it&#039;s new in SQL Server 2005.

This code will do the trick for you.

&lt;pre&gt;SELECT TOP (1) *
FROM (
               SELECT TOP (2) *
               FROM YourTable
               ORDER BY DateEntered
) a
ORDER BY DateEntered DESC&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Neither of those ROWNUMBER examples will work.  SQL Server 2000 doesn&#8217;t have that function, it&#8217;s new in SQL Server 2005.</p>
<p>This code will do the trick for you.</p>
<pre>SELECT TOP (1) *
FROM (
               SELECT TOP (2) *
               FROM YourTable
               ORDER BY DateEntered
) a
ORDER BY DateEntered DESC</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.044 seconds using memcached
Object Caching 309/315 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-23 01:56:29 -->