﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Traversing through Temp Table / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 22:54:50 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Traversing through Temp Table</title><link>http://www.sqlservercentral.com/Forums/Topic1385047-392-1.aspx</link><description>If they can only ever be 0 or 1 then max will do the job, as if anything is set to 1 it will return 1 or if everything is 0 it will return 0[code="sql"]SELECT @Var = MAX(ID) FROM #Temp[/code]</description><pubDate>Thu, 15 Nov 2012 03:41:44 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Traversing through Temp Table</title><link>http://www.sqlservercentral.com/Forums/Topic1385047-392-1.aspx</link><description>Hi,I have i temp table as[code="sql"]CREATE TABLE #TEMP (ID INT)[/code]In this temp table i would be having 2 or more than 2 records. They would be necessarily 0 or 1 value.Suppose if any one of the present value in temp table is 1 then i have to set a variable(Say the variable is @var) to 1. If all the records in the temp table are 0 then i have to set a variable(@var) value as 0.</description><pubDate>Thu, 15 Nov 2012 03:36:26 GMT</pubDate><dc:creator>Shadab Shah</dc:creator></item></channel></rss>