ALTER procedure [dbo].[SelectT_pub_user_ProClassUser] --查询学员信息
@CLASSID varchar(20)
as
select XUHAO=IDENTITY(INT,1,1),a.USER_ID ,a.NAME ,a .SEX ,a.ID_CARD_NUM ,a .WORK_UNIT ,a .SUBJECT ,a .CELPHONE ,a.PHONE ,a.QQ INTO #TEMP
from T_PUB_USER as a,T_PUB_USER_CLASS as b
where a .USER_ID =b .USERID and b.Ctype=7 and [email protected]
SELECT * FROM #TEMP
drop table #temp
(获取序号的时候要创建一个临时表,然后将所有要查询的数据全部存在当前临时表,在查询该临时表中间的所有数据,执行完后删除临时表)