Alter table Patient_data..tbhospitalinfo add isSOAColumnar bit not null default(0) ----------------------------------------------------------------- USE [billing] GO /****** Object: StoredProcedure [dbo].[Billing_CheckOPPendingRequests] Script Date: 05/12/2011 14:09:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create Procedure [dbo].[Billing_CheckOPPendingRequests] @IDNum as varchar(10) as --set @IDNum = '319572B' Select distinct isnull(A.RevenueID,'') as RevenueID, max(isnull(B.ItemName,'')) as RevenueName, count(ItemID) as RequestsNumber from Station..tbNurseCommunicationFile A Left Outer Join Build_File..tbCoRevenueCode B On A.RevenueID = B.RevenueID where A.IDNum = @IDNum and A.StationID = 'OR' and isnull(A.RecordStatus,'') = '' Group by A.IDNum, A.RevenueID