create table #t (ID int IDENTITY, --自增字段
yhm_id int, yhm_name varchar(40))
--向临时表中写入数据
declare @iRecordCount int
insert into #t select yhm_id,yhm_name from dbo.[yhm] order by yhm_id
--select * from dbo.[t]
--取得记录总数
set @iRecordCount=@@rowcount