declare@trun_namevarchar(50) declare name_cursor cursorfor select'truncate table '+ name from sysobjects where xtype='U'and status >0 open name_cursor fetchnextfrom name_cursor into@trun_name while@@FETCH_STATUS=0 begin exec (@trun_name) print'truncated table '+@trun_name fetchnextfrom name_cursor into@trun_name end close name_cursor deallocate name_cursor