if exists(select * from sysobjects where id = object_id(N'dbo.test_cursor') and type = 'P') drop PROCEDURE dbo.test_cursor GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE test_cursor AS Declare @acctNbr varchar(100); Declare @acctName nvarchar(100); Declare MyCursor Cursor for Select AcctNbr,AcctName From base._Member Order By ID Open MyCursor Fetch next From MyCursor Into @acctNbr,@acctName while(@@fetch_status=0) begin begin Select @acctNbr = Convert(varchar(100),@acctNbr) Select @acctName = Convert(nvarchar(100),@acctName) print N'会员卡号:'+@acctNbr + N'-----会员姓名:' + @acctName end fetch next From MyCursor Into @acctNbr,@acctName end Close MyCursor Deallocate MyCursor --execute test_cursor