我尝试使用RAISERROR(Cast (select @HostelId as varchar(50))
在Raiserror上显示我的变量。但我不知道如何将sql变量转换为字符串。
Declare @HostelId int=0;
Declare @Hostels Cursor;
SET @Hostels = cursor for select Hostel.HostelCode
From Hostel
Open @Hostels
While @@FETCH_STATUS = 0
Fetch next from @Hostels into @HostelId
Begin
RAISERROR(Cast (select @HostelId as varchar(50)), 0,0);
End
Close @Hostels