Monday, 3 October 2011

Check Temp Table

IF OBJECT_ID('tempdb..#temp') > 0          
     DROP TABLE #temp 
 
     SELECT * INTO  #temp FROM (SELECT * FROM TABLENAME)

     SELECT * FROM  #temp
     SELECT COUNT(*) FROM  #temp






No comments:

Post a Comment