With the following t-sql query:
select u.userid into #temp from user u where u.type = 1; select top 50 contentid,