use [dbmsg] select * into [dbmsg].[dbo].[unauth_back1] from (select no=row_number() over(partition by name order by getdate()),* from [dbmsg].[dbo].[unauth]) as t where no=1