Home Forums SQL Server 2008 T-SQL (SS2K8) Traversing through Temp Table RE: Traversing through Temp Table
Ant-Green
SSC Guru
Points: 113445
More actions
November 15, 2012 at 3:41 am
#1559266
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
SELECT @Var = MAX(ID) FROM #Temp