I have the following piece of code that returns nothing when there is only one row that fits the criteria. If there are two or more rows that match the criteria it works. Any idea what is wrong??Declare @drugID varchar(4000),@lineresult varchar(4000),@SEND VARCHAR(256), @RECP VARCHAR(256), @TITLE VARCHAR(256), @BODY VARCHAR(4000), @SERVERNAME VARCHAR(256)set @drugID = '' declare r_cursor INSENSITIVE CURSOR FORSELECT AHI_DRUG_DOSE.Drug_Display_Name+ ' ' +convert(varchar(10),AHI_CAB_EVENT.Station_Id)+ ' ' +convert(varchar(25),AHI_CAB_EVENT.Event_Dttm)+ ' ' + AHI_CAB_EVENT.Event_Type+ ' ' + convert(varchar(10),AHI_CAB_EVENT.Trans_Qty)+ ' ' +convert(varchar(25),AHI_CAB_EVENT.Site_Patient_Id)+ ' ' +AHI_CAB_EVENT.Pat_Name+ ' ' +AHI_CAB_EVENT.Misc1FROM AHI_DRUG_DOSE AHI_DRUG_DOSE INNER JOIN CRX_DATA.dbo.AHI_CAB_EVENT AHI_CAB_EVENT ON AHI_DRUG_DOSE.Drug_Dose_Id = AHI_CAB_EVENT.Drug_Dose_IdWHERE (AHI_CAB_EVENT."Station_Id" = 'OPS' OR AHI_CAB_EVENT."Station_Id" = 'OR1' OR AHI_CAB_EVENT."Station_Id" = 'OR2' OR AHI_CAB_EVENT."Station_Id" = 'PACU') AND AHI_CAB_EVENT."Event_Type" = 'WASTE' AND AHI_CAB_EVENT."Misc1" <> 'Partial Dose' AND AHI_CAB_EVENT."Event_Dttm" >= getdate()-1open r_cursor fetch next from r_cursor INTO @drugID while @@FETCH_STATUS = 0Begin FETCH next from r_cursor INTO @lineresult set @drugID = @drugID + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10) + @lineresultENDCLOSE r_cursorDEALLOCATE r_cursorSET @SEND='CRxSystem@system.org'SET @RECP='email@email.org'SET @TITLE='Surgery Drug Wastes'SET @BODY = @drugID SET @SERVERNAME= 'TESTCRXSERV'exec sp_send_cdosysmail @SEND,@RECP,@TITLE,@BODY,@SERVERNAME
thanks for the help!