Hello,
I am trying to insert into a log table that stores the reason behind the non execution of a stored proc. The stored proc runs only if a specific condition is met and for that to execute I am using an if condition. Now the log table comes into picture in the else part and here is what I have in my code for logging:
else select @ID1=ID from [CBH] where [SID] = 2 select @ID2=ID from [PBH] where [SID] = 2 INSERT into dbo.Logtable ( AdditionalInfo ) values('Another Process with ID:'+@ID1+'is currently in use')
INSERT into dbo.Logtable ( AdditionalInfo ) values('Another Process with ID:'+@ID2+'is currently in use')END end
But what I really want to do is:
If @ID1 exists then insert that value in to the logtable
and if @ID2 exists then insert that value in to the logtable.
If both @ID1 and @ID2 exists then insert both into the logtable with the same text.
Please note that the @ID1 and @ID2 are of type bigint and I am trying to insert that along with the text into the log table.
Thanks for your help on this.