Create PROCEDURE my_sql
AS
declare @id int,@loginname varchar(20),@website varchar(100)
declare rs cursor for select top 50 id,loginname,website from union_user
open rs
fetch next from rs
into @id,@loginname,@website
while @@fetch_status=0
begin
print convert(varchar,@id) + ',' + convert(varchar,@loginname) + ',' + convert(varchar,@website)
fetch next from rs
into @id,@loginname,@website
end
close rs
deallocate rs
GO